Description
This is a simple shell script to automate moving of directories and files to a single folder. You can associate the task to any profile and schedule it, for example, at night or on event , if target directory is modified.
In my case, all the wallpapers downloaded in different directories could be moved to a single one with a single click. The directory is then configured in Tapet to import wallpapers from this directory. Similarly, I have also configured a similar script to move all my different backups for different apps in a single folder and then this folder is then synced to Google Drive.
Code
cd /sdcard/Pictures/
folders=("Amoled Pro" "Walli Artworks" "../Papers" "Minimal O");
IFS="";
for folder in "${folders[@]}"; do
file_count=$(ls $folder -1 | wc -l);done
if [ $file_count \> 0 ];
then mv $folder/* Wallpapers/.;fi;
Usage
- Change cd <starting_directory> to any directory relative to which you would be giving the folder paths. It can be the one with most source directories.
- Input your source folder names in folder=("<your folder1 name" "<folder2 name>"). Give each folder name enclosed in double quotes separated by space. Here, you can also provide relative paths. For example, 'Papers' folder in my case is in the directory /sdcard/ so I used .. (one directory up) just like you'd do in terminal.
- I've set a single condition to move only if there's any content in the source folders. You can change the condition here to something like - only check for JPEG files or updated date.
- Describe type of files you want to move. I have used * to move every file.
- Describe your target folder in mv $folder/* <target_folder>/

Folder Move 1.0
Automate & customize moving of files and directories [Shell]