Petri IT Knowledgebase Forums
 

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > DOS Command Shell
Petri.co.il is happy to award auglan the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Notices

BAT file loops, file moving and renaming

BAT file loops, file moving and renaming

this thread has 2 replies and has been viewed 550 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20th June 2012, 18:58
dornjmd dornjmd is offline
Casual
Casual
 
 Join Date: Jun 2012
  6 month star
 Posts: 2
 Reputation: dornjmd is on a distinguished road (10)
Default BAT file loops, file moving and renaming

I need help making a bat file that moves files from subdirectories to the main directory, and renaming the files to include day stamps (yyyy.mm.dd).


I apologize for the question. At one point in time I was actually a pretty decent C++ and Java coder. 12 years away from the compiler gets you rusty.

Let's start off with this disclaimer. My client is an idiot and really doesn't understand drag and drop.

I have a situation where files are coming into a directory from three different sources. Sometimes my client will drag only the file into the directory, other times the folder containing the file will be dragged and dropped.

I want this scenario from my client: Folder \ files

I get this usually: Folder \ files and folder(s) \ files

As I said above, I need to get everything back to the Folder \ files scenario.



Also, I need to append a day stamp (yyyy.mm.dd) on the beginning of the file names.

It would be nice, but not essential, that I can check for the length of the file name and only append the stamp if the name is 8 chars or shorter (excluding the extension).


I already have the structures in place to move and back up the file at the end of every day.



I can do a bunch of this stuff in Java but I am completely clueless with non trivial bat files.

Thank you guys in advance.

Jared
  #2  
Old 20th June 2012, 19:01
Ossian Ossian is offline
Administrator
 
 Join Date: Nov 2003
  6 month star 12 month star
 Location: Bonnie Scotland
 Posts: 15,109
  Send a message via Skype™ to Ossian
 Reputation: Ossian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud of (1300)
Default Re: BAT file loops, file moving and renaming

You don't say which OS you are using, but IMHO investigate powershell -- lots of potential to do this:
http://www.google.co.uk/search?q=pow...HIWG-wbY98TQAw
__________________
Tom Jones
MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
PhD, MSc, FIAP, MIITT
IT Trainer / Consultant
Ossian Ltd
Scotland

** Remember to give credit where credit is due and leave reputation points where appropriate **
  #3  
Old 20th June 2012, 19:04
dornjmd dornjmd is offline
Casual
Casual
 
 Join Date: Jun 2012
  6 month star
 Posts: 2
 Reputation: dornjmd is on a distinguished road (10)
Default Re: BAT file loops, file moving and renaming

Thanks for pointing that out. Win Server 2003.
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Page File thenoo Windows 2000 Pro, XP Pro 5 13th July 2010 02:24
Batch file to edit a txt file that is part of a compiled exe file using for /f Sargeo80 DOS Command Shell 3 28th June 2010 15:07
batch help for renaming text in file wbsimsjr DOS Command Shell 3 6th June 2010 16:35
Moving priv1.edb file never completes mvolkers Exchange 2000 / 2003 5 13th July 2009 06:27
Moving Data & File Permissions UKG General Scripting 15 7th September 2006 16:06


All times are GMT +3. The time now is 19:53.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri