Stephen Wolfram
This dude is just incredible. That's all. Please watch this video, and then watch it again later.
This dude is just incredible. That's all. Please watch this video, and then watch it again later.
After moving to linux main, WinSCP was no longer an option for an easy one-way-sync to backup my phone media.
I spent hours scanning google/stackoverflow/superuser for a better solution, but in the end I opted for a solution based on discussions with GPT-4.
The solution was simple; lftp
let's you mirror files with wildcard patterns. So this new script solved my problem perfectly:
#!/bin/bash # FTP credentials HOST='10.0.0.1' USER='' PASS='' PORT=21 # Remote directory to start from REMOTE_DIR='/' # Local directory where you want to store files LOCAL_DIR='/home/stig/Phonesync' # Directories to exclude EXCLUDE_DIRS=('android','Android','emulated','self','cache','_media','LOST.DIR','ANRSnap','Alarms','AzRecorderFree','Cardboard','Notifications','Podcasts','Ringtones','TTImages_cache','airdroid','caustic') # File patterns to include INCLUDE_PATTERNS=('*.jpg' '*.jpeg' '*.png' '*.mp4' '*.webm' '*.pdf' '*.txt') # Build the exclusion arguments for each directory in the list EXCLUDE_ARGS=() for DIR in "${EXCLUDE_DIRS[@]}"; do EXCLUDE_ARGS+=("--exclude-glob */${DIR}/*") done # Build the inclusion arguments for each pattern in the list INCLUDE_ARGS=() for PATTERN in "${INCLUDE_PATTERNS[@]}"; do INCLUDE_ARGS+=("--include-glob ${PATTERN}") done # Start building the lftp command LFTP_COMMAND=" set ftp:ssl-allow no; set ftp:list-options -a; set net:timeout 30; set net:max-retries 2; set net:reconnect-interval-base 5; open ftp://$HOST:$PORT; lcd $LOCAL_DIR; cd $REMOTE_DIR; mirror --verbose --use-pget-n=8 --parallel=8 --only-newer" # Add the include and exclude arguments to the lftp command for INCLUDE_ARG in "${INCLUDE_ARGS[@]}"; do LFTP_COMMAND+=" $INCLUDE_ARG" done for EXCLUDE_ARG in "${EXCLUDE_ARGS[@]}"; do LFTP_COMMAND+=" $EXCLUDE_ARG" done # Finalize and execute the lftp command LFTP_COMMAND+=" . ; bye" lftp -u $USER,$PASS -e "$LFTP_COMMAND" echo "phonesync done"
netsh wlan set autoconfig enabled=no interface="WiFi"
@echo off
echo Option 1: Enable fix
echo Option 2: Disable fix
SET /P M=Choose an option:
IF %M%==1 GOTO ENABLE
IF %M%==2 GOTO DISABLE
:ENABLE
cls
SET /P input=Interface name (Typically "WiFi"):
netsh wlan set autoconfig enabled=no interface="%INPUT%"
exit
:DISABLE
cls
SET /P input=Interface name (Typically "WiFi"):
netsh wlan set autoconfig enabled=yes interface="%INPUT%"
exit
Save this regcode as something.reg and run it. Then select the Windows Photo Viewer as your new default.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
"MuiVerb"="@photoviewer.dll,-3043"
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget]
"Clsid"="{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget]
"Clsid"="{60fd46de-f830-4894-a628-6fa81bc0190d}"
I needed a way to easily backup new files from selected media from my phone to my windows. Here's a quick and dirty way.
X:\backup\backup.bat
@echo off set "ip=10.0.0.150" ::set /p ip="phone IP ([%ip%]):" :: | marks start of excluded files :: / at end of name means folder, they are recursive :: ; to separate "WinSCP.com" /command ^ "open ftp://user:pass@%ip%:2221/" ^ "synchronize local X:\backup\ / -filemask=*.jpg;*.jpeg;*.png;*.mp4;*.webm;*.pdf;*.txt|android/;Android/;emulated/;self/;cache/;_media/;LOST.DIR/;ANRSnap/;Alarms/;AzRecorderFree/;Cardboard/;Huawei/;HuaweiSystem/;Notifications/;Podcasts/;Ringtones/;TTImages_cache/;airdroid/;caustic/" ^ exit :: pause
Now start the FTP Server on your phone, double click that bat!