Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Command Line Batch Delete

Posted on 2010-11-21
12
Medium Priority
?
366 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 57

Expert Comment

by:Bill Prew
ID: 34184077
Try this:

DEL /S ".*"

~bp
0
 
LVL 57

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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
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 57

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 57

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 57

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 57

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

722 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