How to use robocopy to copy files from a folder folders (robocopy need to go through every subfolder and check for files) - robocopy

#Looping through header files and copy to src/for_src folder
%foreach file_h in $(FOR_INCLUDE_FILES,A)
%exec robocopy /MIR $(FOR_INCLUDE_DIR) $(FOR_PROJECT_OUTPUT_DELIVERY_DIR)/ASM/src/for_src $(file_h,B,>.h)
%endfor
With the above lines i am trying to loop thru the list of files and trying to only copy the matching files of the list using robocopy.
The source directory is a mother folder inside two other folders were there namely asil and QM
My expectation is to search for the file in every iteration inside those sub folders and copy them to the destination folder.
Please help me on how to do copy only the matching files and search inside folder folders for the matching files.

Related

Force RoboCopy to copy files even if they have not changed

What is the proper syntax to force RoboCopy to copy files even if they have not changed (ie. replace the file in the destination with the source file even if the source or destination files have not changed)?
File extensions I'm working with are .XMP files (Adobe camera RAW files), and PSD (Photoshop document files).
(I use RoboCopy to automate the process of copying these files from my photo editing drive to a backup drive and want to ensure that RoboCopy always copies all changes made to these files.)

go through sub directories using for loop in batch

I try make a script witch go through a directory and for each file in the directory it will make a zip archive copy the archive somewhere else and then extract the archive. In the end, the whole directory i copy from has to equal to the new directory somewhere else but in files were copied has archive.
i had a problem with going through all files in the directory because it has a lot of sub directories so i could not go through all of them with a simple for loop.
My plan was to copy first all the directories and sub directories "xcopy /t /e" and then go through the files and archive copy and extract each one of them individually but as i said earlier i could not do it.
If someone can help me and show me how to to go through files like that or how to accomplish my mission, it will be perfect.
Thank you.
You could use recursion for that. Both zip -r or rsync could do the job in a very simple way. You do not have to loop.

Read all the files in the folder/subfolder in Spark

If we have a folder with multiple subfolders, to read the text files in the folder we can use sc.textFile("folder/*/*.txt), but if we are not sure on the level of subfolders how to read the files recursively from folder and subfolders in spark?
I tried with sc.textFile("folder/**/*.txt) but it's not working and taking only immediate nested folder not all the subfolders(level).

Filter files out of a folder, and copy them to a other folder

I ask a few questions here and every time I am very pleased with the answers, so here we go again.
I have three folders inside the folders the files have the same names except for the file structure:
1 folder with .zip
1 folder with .7zip
1 folder with different folders
I really would like to get all the matching files from the .zip.
So .zip is leading and I am looking for a batch file that will copy the files from the other folders.
I really hope this makes any sense :) English isn’t my first language.
Use the find command.
find . -regex '.*\.zip' -exec cp {} target_dir \;

Install4j "Copy files and directories" installer action does not copy the file directory path

I do a backup of the files that need to be replaced as part of the installation. For this I use the above action. However, it just copies the files in the child directory to the destination directory but not the directory hierarchy of the source to the destination directory. Example: I have a some files in this directory structure \dir1\dir2\dir3\files. It copies only the files under dir3 but not the \dir1\dir2\dir3. I need to preserve the directory structure in the backup. Can anyone help with this please?
I am using Windows 7 Enterprise.
Thanks very much.
You have to select the root directory in the action, i.e. the one containing "dir1". Then, it will copy the whole directory tree to the destination.
If you want to copy only parts of the directory tree, use the "Directory filter" and "File filter" properties.