Last active
August 24, 2023 12:15
-
-
Save N3RDIUM/87bdf9776edebb4ab9a0a3efad75bfb2 to your computer and use it in GitHub Desktop.
CSV file based file moving script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM CSV file based file mover for windows! | |
REM Take input from user about the from and to directories | |
set /p from_dir="Enter the path of the directory from which you want to move the files: " | |
set /p to_dir="Enter the path of the directory to which you want to move the files: " | |
REM Read all lines from the csv file and move the files from the from_dir to the to_dir | |
for /f "usebackq tokens=*" %%p in ("files.csv") do ( | |
echo Moving %%~p from %from_dir% to %to_dir% | |
move "%from_dir%\%%~p" "%to_dir%\%%~p" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# CSV file based file mover | |
# Take input from user about the from and to directories | |
echo "Enter the path of the directory from which you want to move the files" | |
read from_dir | |
echo "Enter the path of the directory to which you want to move the files" | |
read to_dir | |
# Read all lines from the csv file and move the files from the from_dir to the to_dir | |
while IFS="" read -r p || [ -n "$p" ] | |
do | |
echo "Moving $p from $from_dir to $to_dir" | |
mv "$from_dir/$p" "$to_dir/$p" | |
done < files.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment