Solved

Batch File Script to move files from changing directories

Posted on 2015-02-12
4
143 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 24

Accepted Solution

by:
NVIT earned 500 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 24

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

Industry Leaders: 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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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?
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…

739 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