prosit
asked on
DOS FTP
Hello,
I have a security camera that records on motion detect and the way I get it off the camera is either to take the SD card out and copy it or I can FTP to it.
I'd like to create a dos program that automatically grabs the video, but I can't find a good way to iterate through the directories.
The structure is as follows:
/IPCamera/FI9821W_00626E53 BD32/recor d/20150621
/IPCamera/FI9821W_00626E53 BD32/recor d/20150622
/IPCamera/FI9821W_00626E53 BD32/recor d/20150623
etc.
Inside each of these directories there's another directory with a time-stamp "20150621_020331" in which the files are placed.
Any clever way of doing this?
tnx
~j
I have a security camera that records on motion detect and the way I get it off the camera is either to take the SD card out and copy it or I can FTP to it.
I'd like to create a dos program that automatically grabs the video, but I can't find a good way to iterate through the directories.
The structure is as follows:
/IPCamera/FI9821W_00626E53
/IPCamera/FI9821W_00626E53
/IPCamera/FI9821W_00626E53
etc.
Inside each of these directories there's another directory with a time-stamp "20150621_020331" in which the files are placed.
Any clever way of doing this?
tnx
~j
Note: Please choose the correct ftp commands to allow the script to work.
runftp.txt
runftp.txt
open "myservername/serverip"
"%username%"
"password"
lcd c:\securityfiles
cd /
bin
hash
mget * /a
bye
getfiles.bat"c:\windows\system32\ftp.exe -s:runftp.txt"
ASKER
NewVillage... I definitely wanted to avoid doing the SD card; the FTP method was what I'm looking for, sorry if that was unclear.
David,
When running it as is, I get the following result, note that there were three directories under the folder "record":
I tried fiddling with it and use MGET -rf * which seems to want to start copying files but it can only download files not directories.
And to make it worse, I'd also like to delete the files when they're deleted. I'm almost at a point where writing a program might be easier...
~j
David,
When running it as is, I get the following result, note that there were three directories under the folder "record":
230 OK. Current directory is /
ftp> lcd E:\AutoVideo
Local directory now E:\AutoVideo.
ftp> cd ipcamera
250 OK. Current directory is /IPCamera
ftp> cd FI9821W_00626E53BD32
250 OK. Current directory is /IPCamera/FI9821W_00626E53BD32
ftp> cd record
250 OK. Current directory is /IPCamera/FI9821W_00626E53BD32/record
ftp> bin
200 TYPE is now 8-bit binary
ftp> hash
Hash mark printing On ftp: (2048 bytes/hash mark) .
ftp> mget * /a
200 TYPE is now 8-bit binary
ftp> bye
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
I tried fiddling with it and use MGET -rf * which seems to want to start copying files but it can only download files not directories.
And to make it worse, I'd also like to delete the files when they're deleted. I'm almost at a point where writing a program might be easier...
~j
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
P.S.: Wget supports mangling with the contents of remote ftp sites as well - if told to do so, it leaves raw listings of remote directoy content behind which could be parsed to i.e. remove remote files with FTP commands.
ASKER
Just what I was looking for, thank you!
ASKER
Do you know how to then delete the remote files? it seems wget doesn't support it...
wget / mget only GETS files you will have to send a del command for each file
ASKER
And then I'm back to square 0 since I'd now have to write something to delete the files...
I did read something about a patch that would allow wget to do so, do you know anything about that?
I did read something about a patch that would allow wget to do so, do you know anything about that?
If you remove the card and connect the card to a computer, that gives the card a drive letter. Then, you can use a .bat file to copy the files.
In the folder structure you show, do you want to copy just the files, but not the folders? I assume you don't want to use Windows Explorer to traverse the folders then finally get to the files.
What are the files named like?
Assuming all the filenames are unique, you could copy all the files to one folder.
- Save below code to a .bat file, e.g. FindFiles.bat
- Note: The COPY command overwrites target duplicates
- Change following to your needs: srcdir, tgtdir
Open in new window