This script allows users to search for and copy files specified in a CSV to another directory.
- Searches a given directory (and its subdirectories) for files.
- Takes file names from a CSV and looks for them.
- Copies found files to another directory.
- Python 3.x
- pandas (
pip install pandas
)
-
Run the script:
python csv-file-search-and-copy
-
Input the directory to search in:
Enter the directory to search in: /path/to/search/directory
-
Input the directory to copy the files to:
Enter the directory to copy the files to: /path/to/copy/directory
-
Input the location of the CSV file:
Enter the location of the CSV file: /path/to/csv_file.csv
The CSV should have a column named "File name" containing the names of the files to be searched.
-
The script will then search for the files in the specified directory (and its subdirectories). If found, it will copy each file to the destination directory and notify you with a message:
Copied file example.txt to /path/to/copy/directory
If the specified CSV file is not found, the script will notify you with:
CSV file not found. Please check the file path and try again.
If you found this helpful, please consider:
- Buymeacoffee: Link