Windows tool to delete content from several different folders on click? - windows-7-x64

I have several folders spread all across my disk and I have to manually delete the content multiple times a day (its some cache thing). Is there a nice tool where I can specify the folders and delete their content at once with either a click or shortcut or something? The folders themselves have to stay.

You could always write a batch script to do this for you.
Create a file, call it 'wipefolders.bat'
Then write something like this inside
cd <drive>:
cd root\path\of\folders
cd foldera
del *.*
cd ..
cd folderb
del *.*
etc...
Then just create a shortcut to this link.

Related

Move files from multiple folders to a single folder without extension

i am a windows user and i need help with something
i have a folder and in it it has multiple folder.and in those multiple folders i have more folders and in those folder i have files without any extension like jpg,txt etc
here is a sample
D:\test\1\something1\1235486[file]
D:\test\1\something2\1235486[file]
D:\test\2\something1\1235486[file]
D:\test\2\something2\1235486[file]
so now i want to move all those random number files i.e 123456789[these files are without any extension] to D:\newtest
so i will have files like
D:\newtest\123456789
D:\newtest\123456789
D:\newtest\123456789
D:\newtest\123456789
etc. i could have easily done this with search option if it had a extension.but what can i do now?
Finally Found a solution for this problem
First make another folder where you want to transfer file
lets say i have a folder named ABC and i want to transfer its files to XYZ [only files not folders]
then open Command prompt [cmd]
and enter this
for /f "tokens=*" %a in ('dir /b /s /a-d "d:\abc"') do #copy "%a" "d:\xyz
Change the folder names and hit enter.it will transfer all the files in it

Is there any batch command to move files and delete empty sub folders

Anyone know of a simple batch command to move files and delete empty sub folders? Just got a new external and when I copied everything over it resulted in something like this. F:\Music\John Denver\John Denver\files1-10 F:\Music\TheBeatles\TheBeatles\files1-10 and so on, for say, 350+ folders. I don't want to waste that much time manually moving them up one folder and deleting sub folders... Not all files are same file type, and not all folders are music. Some folders have other sub folders that I want to keep (mostly for music files, such as artist\album\files) Is there a way to do this instead of the old fashioned way? Any help is appreciated.
You can use ROBOCOPY.
ROBOCOPY source destination /S /MOVE
/S flag is used to exclude empty subfolders.
ROBOCOPY "F:\Music\John Denver\John Denver\files1-10" "F:\Music\TheBeatles\TheBeatles\files1-10" /S /MOVE

Batch File to Automate backup folders

So, I currently have a Drobo server that houses a Backup folder for customers that need to have their Hard drive files backed up. I create a folder for each customer in this backup folder. It's our policy to keep these files for our customers for 30 days, after which, need to be deleted. I'm wondering if its possible to make a batch file that can scan the entire Backup folder, each folder for each customer ONLY, not all the files, just the folder by modified date and if it is older than 30 days, move the entire folder that I'll label Delete for further review before deleting. I'm going to make a second batch file to delete all the folders and files once inside that delete folder, but I need the first batch file that scans just the folders' modified date in order to determine if it needs moved first. Any help would be appreciated. Thanks.
Forfiles /P C:\test\ /D -30 /c "cmd /c move #file c:/delete"
just an example of script you might use

How to use Robocopy to copy a template folder structure to other folders?

I need to copy all the folders within one folder, to multiple other folders. The folder structure I want to copy from is here:
x:\Customer1\Site1\
I want to copy all the folders within Site1, to all the folders within the following directory:
X:\Customer1\
Obviously I don't want to copy the folders back into Site1 again, only every folder within Customer1, excluding Site1.
Site1 contains 19 folders. I would like to end up having those 19 folders within every folder in the Customer1 folder. Can someone please tell me how to achieve this?
I have been looking at the Robocopy MS page to learn about all the switches and options, but there doesn't seem to be anything to help me with this 'copying folder tree from one folder to multiple folders' that I need. Please give me any reference
Many thanks
Naz
As far as I know, this is only possible with xcopy's /t-switch which copies only the folder structure (note that if you also want empty folders to get copied you have to put the '/e' -switch as well)
To copy the structure in every subfolder a for-loop is the way to go:
set customer1="X:\Customer1"
set site1="Site1"
for /f %%d in ('dir %customer1% /b /ad') do (
if %%d NEQ %site1% xcopy %customer1%\%site1%\*.* %customer1%\%%d\*.* /t /e
)

How can I remove a Windows directory without following junction points?

I have a Perl script that needs to delete a directory with all its contents.
Sometimes this directory contains a junction point into another directory. If I rmtree() naively, the rmtree() call will also delete all the files inside the target folder of the junction. I'm looking for a way to not do that, and instead just remove the junction.
Non Perl solutions would also be appreciated.
I just typed "junction point" into Google and found my way to
http://en.wikipedia.org/wiki/NTFS_junction_point
Command Prompt (cmd.exe)
The dir
command in Windows 2000 or later
recognizes junction points, displaying
instead of in
directory listings (use dir with the
/A or /AL command-line switch).
Any
commands that would normally affect
files inside a normal directory will
act the same here. Thus the command
del myjunction should not be used —
this will just delete all the files in
the targeted directory.
The commands
rmdir and move work fine with
junctions, with the caveat that move
won't let the junction move to another
volume (as opposed to Windows
Explorer, as mentioned above.)
The
rmdir command is safe in that it only
deletes the junction point, not the
targeted files. Whilst walking through
the directory with the command line
interface, files can be deleted, but
unlike explorer, directories can also
be deleted (using rmdir /s dirname for
example.)
Using the linkd command with
the /d switch is a safe way to delete
junction points.
From what I can see you can, for example, use dir and grep the output for <JUNCTION> or use the Windows rmdir. I think you can use either of these from Perl via system.
To find out where are the reparse points (or "junction points", if you will):
dir /a:l /b > myjunctions.txt
Will show all reparse points in the current directory. You can add /s, but beware that reparse points inside reparse points will be listed as well.
Suppose myjunctions.txt contains the line x:\subdir\foo. To remove it, you issue
fsutil reparsepoint "x:\subdir\foo"
And voilá! Your junction point is gone, and the original directory is untouched!
FastCopy utility does this: http://ipmsg.org/tools/fastcopy.html.en
I am using this program for copying or deleting folders that may contain junctions as subfolders so that the junction targets remain untouched. The junction points are properly copied while copying, even when the target drive is different.
Windows Explorer at least in Windows 7 Ultimate works also as wanted while deleting - junction targets remain intact.
But copying folders that contain junctions as subfolders in Explorer still does not work as intended - it actually does something that I cannot yet perhaps quite entirely describe: the junction folders seem to be copied as normal folders, but their content is empty.