Solved

Need a script file to create a new folder and move contents from old location

Posted on 2014-01-21
4
827 Views
Last Modified: 2014-01-23
I have a few thousand folders with .pdf and .mov files in them. Some of the folders only have one file or the other as well.   I need to move the .mov files to a network share but I need the same folder name that the file is in now, to be created on the network share, and then the .mov files to be moved into that folder.   I need the old folder to stay if it has a .pdf(s) in it, but be deleted it if only had .mov files in it and is now empty.  These .mov files are not movies but medical documentation.  :)
Thanks for any guidance.
0
Comment
Question by:digital0g1c
4 Comments
 
LVL 18

Accepted Solution

by:
Dennis Aries earned 500 total points
ID: 39799294
How about simply using xcopy?

To copy all files recursively excluding pdf-files:
xcopy <source> <destination> /EXCLUDE:.pdf /S /I  

Open in new window


Delete all .mov-files recursively
del /S *.mov

Open in new window


Delete all empty directories:
Create a bat-file with the following line:
for /f "usebackq" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"

Open in new window


this will remove all empty directories recursively (taken from MSDN)
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 39799740
Is there just one level of folders, or are there folders withing the folders?

~bp
0
 
LVL 1

Author Closing Comment

by:digital0g1c
ID: 39804336
This worked great.   One thing is in the /EXCLUSION:.pdf needs to be /EXCLUSION:file.txt where file.txt is just a text file that has the exclusion files one per line like .pdf .txt ,etc.  Worked great though!  Thanks for your help!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

746 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

12 Experts available now in Live!

Get 1:1 Help Now