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

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 \;

Related

Is there a way in "Copy Files Tasks" in TFS to Copy the files and also it's Folders and subfolders with it's files

For this example below, I want to use the "Copy Files Tasks" to copy the "Project1" and it's subfolder namely "bin", "ConfigFiles", etc. that contains it's files. But can also copy the folder in "Project1" as a directory and it's files within, to the Target Destination. I don't want to use the "Windows Machine File Copy" tasks...
Thank you in advance.
As Daniel Mann mentioned, you can find the glob patterns in the task link here.
In addition, since you'd like to copy the "Project1" as well, you need to remove it in Source Folder but specify in content.
Sample as below:
I checked the result:

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

#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.

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.

My .gitignore file is matching items that I did not expect it to match?

I have a .gitignore file with the following:
cache/
resources/
The file correctly matches the directories in my root:
cache/
resources/
The files in these directories are ignored and therefore because this is a git system, the directories themselves are ignored. This is also good.
But it also matches a sub directory in a sibling root directory:
default/cms/resources/library/index.cfm
And ignores this path which is not good.
How can I rewrite the .gitignore file so that:
default/cms/resources/library/index.cfm
Is not matched?
And only files & subdirectories inside cache/ & resources/ are matched.
Thank you in advance for any advice you can give me.
If anyone is interested, I have done some in depth tests using .gitignore [which I probably should have done in the first place, but I guess I was just being lazy], and the answer to the question is:
cache/**
resources/**
I hope this helps anyone, in a similar situation...

How to get the files only from a bzr repository?

I meant, I don't need all the ".bzr" folders under each directory (I may have hundreds of nested ".bzr" folders); I want to check out those actual files only. Thanks!
Are you really sure you have hundreds of nested ".bzr" folders? There should be only ONE .bzr folder per project, right at the top level directory of the project, no additional .bzr folders in subdirectories. (You might be mixing it up with Subversion?)
It seems that maybe you want to get all the project files without any .bzr folders or Bazaar files. If that's the case, cd to your project and run any of these commands:
bzr export /tmp/project-as-dir # export files into a directory
bzr export /tmp/project.tar # export files into a tar file
bzr export /tmp/project.tar.gz # export files into a tar.gz file
Simply remove the folders, e.g. using find -type d -name .bzr -exec rm -rf {} +
Note that you won't be able to use bzr in that copy anymore (i.e. you can't commit stuff etc.).