Any windows command line guru's on here? Need help.

Any windows command line guru's on here? Need help.

Author
Discussion

LeeThr

Original Poster:

3,122 posts

172 months

Monday 27th July 2015
quotequote all
I need some help with a script/batch file. On a customers site, we do a daily backup of a database, but this has to be done late evening so that everybody's logged out and and the files aren't locked. Before I got here they were simply using teamviewer to log in and copy the files over manually every night. I wrote a batch file to be run via task scheduler to add them into a zip archive and then upload it to an FTP site on our server.

Which has worked but also come into some issues, people are leaving themselves logged into the application and keeping the lock on the files, which then causes an error with win rar as it brings up a message to say it can't access the files due to being in use. Which put's a big spanner in the works as until the message box is closed it does not carry on with the script and also keeps task scheduler stuck on this one task meaning the other tasks don't run either.

What I want to know is, is there a command line argument to close all open files in one shared folder. I have done a search and the only commands I have found either require you to know the exact ID of the open file which alters all the time, or just to simply close the entire lot which also wouldn't be any good as there other processes/users on at that time using those files.

LeeThr

Original Poster:

3,122 posts

172 months

Monday 27th July 2015
quotequote all
Can't say I have, can't say i've even heard of it before either.

LeeThr

Original Poster:

3,122 posts

172 months

Monday 27th July 2015
quotequote all
anonymous said:
[redacted]
It's not MS access, the database is under a product produced by the company I work for.

LeeThr

Original Poster:

3,122 posts

172 months

Monday 27th July 2015
quotequote all
It's a product called Ffenics, derived from Data Ease.

I've been told that the simplest way of backing it up is to simply just copy the entire folder the application is stored in. It's just the file locking that causes an issue.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
jjlynn27 said:
WinRAR is doing you a favour. Just copying (presumably database) files is surefire way of not having consistent backup. Did you ever try to restore from all those files that you are copying across?
Yes we have, and there's never been a problem with the replicated data.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
Philemon said:
All things being considered, why don't you go to their dedicated forum and ask one of their "gurus" what they suggest, since this must be a recurrent issue, not unique to your application?
I work for the company that develops Ffenics, and the head developer is the one that told me that copying & pasting or archiving is fine. When he's done it manually in the past he's simply gone into computer management and closed the open shared files. Which is what I need to be able to do via the command line.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
snowy said:
If the database engine runs as a windows service, stop the service(s) that would remove any locks on open files, after the folder has been copied, restart the service
Unfortunately there are no services to stop.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
anonymous said:
[redacted]
Our head developer, is actually the former head developer of DataEase. The product in itself does work very well. It's just this backup issue really.

The issue is on a customers site to which we only have access to one PC, and as stated shutting down everything else just isn't an option.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
Robocopy seems to have done the trick, I modified my batch file to use robocopy to copy the directory from the server on to the work station we have access to, which was then archived successfully with no warnings about any files in use etc. And successfully uploaded to our FTP site.

LeeThr

Original Poster:

3,122 posts

172 months

Tuesday 28th July 2015
quotequote all
Nuclear Biscuit said:
As others have said, have you tried retoring from a backup? They're not a lot of use if you can't.
Yes we have and there's been no issues so far with any copies made.