Solved

Command Line Batch Delete

Posted on 2010-11-21
12
321 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 51

Expert Comment

by:Bill Prew
Comment Utility
Try this:

DEL /S ".*"

~bp
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
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
Comment Utility
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
 
LVL 23

Expert Comment

by:DanCh99
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:jaysonmeyer
Comment Utility
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 51

Expert Comment

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

~bp
0
 
LVL 19

Accepted Solution

by:
Thommy earned 500 total points
Comment Utility
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 51

Expert Comment

by:Bill Prew
Comment Utility
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 51

Expert Comment

by:Bill Prew
Comment Utility
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 51

Expert Comment

by:Bill Prew
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
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…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now