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

x
?
Solved

Batch File Script to move files from changing directories

Posted on 2015-02-12
4
Medium Priority
?
145 Views
Last Modified: 2015-02-13
Hi,
I need help with how I can get a bat file to move files from folders that change name.
We have 2 files that get generated and they go into folders named "date" (so 2.10.15, 2.11.15, 2.12.15, etc etc)
How do I tell my script how to go to these changing folder names?
Currently I just have:
$ftp = "ftp://123.123.123.123/
$user = "Username"  
$pass = "Password"
$uploadfpath = "L:\Folder1\Archive\Folder2\Folder3\2015\02\20150211"
So it all stay consistent up until Folder3 - then the folders go year, then month and then a folder called 20150211 and in this folder are the 2 files I need to copy to my FTP.
I can get it to work with the above line but that only works for that specific folder/date - tomorrow it will not work.
Any help?
Thanks,
Dan
0
Comment
Question by:Fragclub27
[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
  • 2
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
NVIT earned 2000 total points
ID: 40606755
for the current date, you can use:
set today=%date%
set yyyy=%today:~-4%
set mm=%today:~4,2%
set dd=%today:~7,2%

$uploadfpath = "L:\Folder1\Archive\Folder2\Folder3\%yyyy%\%mm%\%yyyy%%mm%%dd%" 

Open in new window

0
 
LVL 1

Author Comment

by:Fragclub27
ID: 40607824
Thanks - will test it out now
0
 
LVL 25

Expert Comment

by:NVIT
ID: 40608436
BTW, your code doesn't look like .bat code. But, your topic and title mentions batch, and the body says ...get a bat file... So... I responded anyway.
0
 
LVL 1

Author Comment

by:Fragclub27
ID: 40608445
Sorry - that was my error - it is shell!
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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

670 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