Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Command Line Batch Delete

Posted on 2010-11-21
12
Medium Priority
?
372 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
12 Comments
 
LVL 59

Expert Comment

by:Bill Prew
ID: 34184077
Try this:

DEL /S ".*"

~bp
0
 
LVL 59

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:Meir Rivkin
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 59

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 2000 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 59

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 59

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 59

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

885 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