Skip to content

Instantly share code, notes, and snippets.

@N3RDIUM
Last active August 24, 2023 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save N3RDIUM/87bdf9776edebb4ab9a0a3efad75bfb2 to your computer and use it in GitHub Desktop.
Save N3RDIUM/87bdf9776edebb4ab9a0a3efad75bfb2 to your computer and use it in GitHub Desktop.
CSV file based file moving script
@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"
)
#/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