Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9047

Exclude files with no extension - XCOPY or ROBOCOPY

$
0
0

I am trying to build a script that can copy folders, subfolders and contents from one drive to a backup drive. There are several files in each folder, subfolder. The condition I need to meet is that I only copy the files that have extensions, eg: ".txt", ".log", etc. The extensions vary from folder to folder, making it difficult to write all the extensions in a text file.I was thinking of trying to exclude all files that have no extension, and copy all files that have any extension, as this is the requirement of the script. I have tried to do this, and it does not work. The batch script code is:xcopy "source_folder" "destination_folder" /s /i /exclude:"\."

In addition, I have also tried to copy all files and then delete the files with no extensions, which works on a sample case, but is not viable since it will kill the network in terms of storage. The code is:

xcopy "source_folder" "destination_folder" /s /idel /s "destination_folder\*."

I am very new to batch scripting, so any advice/ help is appreciated.


Viewing all articles
Browse latest Browse all 9047

Trending Articles