Solved

Command Line Batch Delete

Posted on 2010-11-21
12
364 Views
Last Modified: 2012-05-10
Hello,

I transferred a folder from my Mac to my PC and noticed its almost 4 times the original size because it copied the files and added a . infront of them all, my question is would there be a way to made a batch file that will go through all the pidgin nested folders and delete any file starting with a . for example, instead of level.dat there will be an extra file called .level.dat

Thanks in Advance!
0
Comment
Question by:jaysonmeyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34184077
Try this:

DEL /S ".*"

~bp
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34184079
Do that from the top directory that has the pad files, and subfolders of bad files, in it.

~bp
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 34184105
here's a vb script which does that, replace the FOLDER_PATH const.

Const FOLDER_PATH = "c:\temp\file"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FOLDER_PATH)
For Each objFile In objFolder.Files
if Left(objFile.Name,1) = "." then
Set aFile = objFSO.GetFile(objFile.Path)
aFile.Delete
end if
Next

Open in new window

0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 23

Expert Comment

by:Danny Child
ID: 34184703
if there are duplicates of all files, why is it FOUR times bigger in the new copy?  Should be just double?  Just asking in case there's more duplication issues to worry about.  
0
 
LVL 19

Expert Comment

by:Thommy
ID: 34185990
Following billprew you can use "DEL /S ".*" from your top folder, but you can also specify your top folder like this:

DEL /S "C:\Folder1\Folder2\.*"
0
 

Author Comment

by:jaysonmeyer
ID: 34196310
I tried running

DEL /S ".*"

with no luck, nothing was deleted, I can go into some nested folders and some of the extra items my Mac added are still there, but I can manually delete them. Normally I wouldn't mind deleting the extra files but there's 64 folders in the main folder and each of those folders has approximately 40 more folders.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34196504
If you do DIR /S ".*" do the files list?

~bp
0
 
LVL 19

Accepted Solution

by:
Thommy earned 500 total points
ID: 34196546
If have tried DEL /S ".*" and DEL /S "C:\Folder1\Folder2\.*"

Both solutions worked fine.

If you call DEL /S ".*", keep in mind that you have to call it from out of the top folder!!!!

Try DEL /S "C:\Folder1\Folder2\.*" and specify your top folder as a parameter for the DEL command (Replace C:\Folder1\Folder2\ with your specific top folder for the ".*" files)

If you do so, it doesn't matter from where you start it...


0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34196590
I think these files may have the "hidden" attribute set actually, so try either of these:

DEL /A:H /S ".*"

DEL /A:H /S "C:\Folder1\Folder2\.*"

~bp
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34388623
This is a tough one, based on the original question I believe either #34184077 or #34196590 are solutions to the original question.  But without confirmation from the poster we can not be 100% certain.

~bp
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 34388628
I would also add that #34184105 should be a viable solution as well, and we have no info if the question prefers a BAT or VBS solution.

~bp
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question