Solved

Batch File Script to move files from changing directories

Posted on 2015-02-12
4
140 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
python question 5 76
creating threads in delphi 1 101
Recommendation vb6 to vb.net or others 14 142
Please help| Getting the syntax error in below query. 2 56
A short article about a problem I had getting the GPS LocationListener working.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

786 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