Writing a script to move files

Ask a question


I need to write a script that will search a directory and its subfolders for *.txt files and *.tiff files, each .txt file having a corresponding .tiff file, the files will be located in different folders within the directory which will be stored in a network drive (file server). After locating the files I need to move them in to a new folder together. Can anyone help with this, I'm new to coding and could use some help.


You can use regular dos commands to create the list of files you need by using the dir command. Go to the folder where you want to start looking for files in your command prompt and type:

dir /b /s *.txt *.tiff > file_list.txt 

This will create a file "file_list.txt" listing all the txt and tiff files in that folder and subfolders. Once you have this list, you can use any language to create a copy from to process. I can create a quick PHP page if needed to do this.


Thanks to Joey for this tip on the forum.

Batch file - File transfer to server with different domain
Windows - Exception Processing Message