Delete folders and files from many subfolders - windows

I have this structure - main folder with many subfolders (names for example only):
Mainfolder
|-subfoldernamea
|-subfoldernameb
|...
|-subfoldernamez
each subfolder have folders and files.
I need to delete folders and files (older than 1 month) in each subfolder.
It is possible to create simple cmd script, or i need manually write all subfolders names in script?

Related

Find and copy all files containing keyphrase to new folder, preserving original folder structure

I have a folder that contains multiple subfolders, and each of those subfolders may contain their own subfolders, which may then contain their own subfolders, etc. and all of these folders may contain .txt files. I want to search all of the folders for files containing a certain phrase, then copy those files to a separate folder while maintaining their original folder structure. For example, I start with this:
original folder
subfolder 1
subfolder a
textfile1.txt
textfile2.txt
subfolder b
subfolder 2
textfile3.txt
subfolder 3
textfile2 and 3 contain the phrase. My destination folder ends up like this:
destination folder
original folder
subfolder 1
subfolder a
textfile2.txt
subfolder 2
textfile3.txt
How do I do this?

Finding and copying files in subfolders to a unique folder giving them their path names

I need to do a bash script in order to copy all files which are in various subfolders and sub-subfolders of a main directory to a unique another folder while giving them a new name indicating their source.
Source paths and files are like:
MainDir/SubFolderX/SubSubFolderXY/fileZ.dat
MainDir/UnknowName../AnotherUnknowName../AnyFile.anyExtension
... Etc
Destination folder with renamed files would be:
NewDir/SubFolderX_SubSubFolderXY_fileZ.dat
NewDir/UnknowName.._AnotherUnknowName.._AnyFile.anyExtension
Etc
What I know is that there is only 2 levels but the names of the subfolders, the subsubfolders, the files, and their extensions could be anything.

Copy all files from a subfolder to another subfolder of the same name Windows 10

So I want to copy all files in folder_A/theatre into folder_B/theatre,
folder_A/show into folder_B/show etc.
I have 150 subfolders per parent folder in total, with all subfolders and files uniquely named.

How to extract all files at once in folders from a tar.gz file

I have a tar.gz file which includes 2 tar files and each tar file includes several folders and subfolders that include my required files.
I want to extract the final files from those subfolders in a directory.
I know I can use something like tar -xzvf but finally, it gives me all the folders and subfolders and the files I needed in those subfolders.
Example file:
file.tar.gz: this file contains 1.tar and 2.tar. 1.tar contains folder1, folder2, ..., folder100. and 2.tar contains foldera, folderb, ..., folderz. My text files are in these subfolders.
I want to extract all of my text files in a user-defined directory without extracting subfolders. my_dir/*.txt
Any help would be much appreciated.
Thank you.

Why are the contents of the subfolders when MQFTE is used for transfer?

Hi when I tried to transfer the contents of a folder ( The folder has several subfolders and few files) using MQFTE ftecreatetransfer command, Not only the few files in the folder but also the contents of the subfolder are transferred to destination. The same subfolders are created in destination and the contents are transferred. Is there a way to avoid the files from subfolders being transferred ?
As per this page in the Infocenter:
When a directory is specified as a source file specification, the
contents of the directory are copied. More precisely, all files in the
directory and in all its subdirectories, including hidden files, are
copied.
However, it looks like they anticipated your question because the page recently added this clarification:
For example, to copy the contents of DIR1 to DIR2 only, specify
fteCreateTransfer ... -dd DIR2 DIR1/*
So instead of specifying the folder, add the wild card to the end and you get just the files in the top level of that folder. (Assuming of course that you do not also use the -r option!)

Resources