Solved

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

Posted on 2014-01-21
4
846 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
[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
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 56

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

Independent Software Vendors: 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!

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

632 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