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

171 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.

WinstonWolf

72,857 posts

239 months

Monday 27th July 2015
quotequote all
Have you looked into Robocopy's capabilities?

illmonkey

18,177 posts

198 months

Monday 27th July 2015
quotequote all

LeeThr

Original Poster:

3,122 posts

171 months

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

LordGrover

33,538 posts

212 months

Monday 27th July 2015
quotequote all
Does this help: click?

WinstonWolf

72,857 posts

239 months

Monday 27th July 2015
quotequote all
Have a look into it, you can set it up with all manner of options in terms of retries, using backup mode only copying changed files etc. It's a useful tool in any tecchies toolkit when you're dealing with data.

LeeThr

Original Poster:

3,122 posts

171 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.

R8VXF

6,788 posts

115 months

Monday 27th July 2015
quotequote all

LordGrover

33,538 posts

212 months

Monday 27th July 2015
quotequote all
Isn't that just a long-winded modern way of doing the for loop above?

R8VXF

6,788 posts

115 months

Monday 27th July 2015
quotequote all
Pretty much. I couldn't personally work out a way of doing the cmd for loop to search for the folder name smile

gowmonster

2,471 posts

167 months

Monday 27th July 2015
quotequote all
is it on a volume that you can do a volume shadow copy on and get the file from that?

gowmonster

2,471 posts

167 months

Monday 27th July 2015
quotequote all
does the software come with a manual that suggests how to back it up?

cornet

1,469 posts

158 months

Monday 27th July 2015
quotequote all
You really need to know what database is being used.

Depending on the database blindly copying the files of a running database is a sure fire way to end up with corrupted backups, even if the DB is locked.

Same goes for creating a shadow copy and copying data.



LeeThr

Original Poster:

3,122 posts

171 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.

cornet

1,469 posts

158 months

Monday 27th July 2015
quotequote all
LeeThr said:
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.
New one on me had a quick look round their website and won't be using it any time soon.

If Ffenics say that's the way to back up then you can't do much other than trust them. I'd just make sure you regularly restore the backup to a staging server to make sure it actually works.

R8VXF

6,788 posts

115 months

Monday 27th July 2015
quotequote all
anonymous said:
[redacted]
It wasn't just me then?! Why do people insist on rewriting db engines?

skelters

423 posts

134 months

Monday 27th July 2015
quotequote all
Buy some backup software for the PC / Server that will backup everything required and deal with the locked files.


jjlynn27

7,935 posts

109 months

Monday 27th July 2015
quotequote all
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?

supersport

4,054 posts

227 months

Monday 27th July 2015
quotequote all
Some companies just do odd things, I once worked for an outfit where the developers hated Microsoft so much that they spent most of their day complaining about MS (despite all the customers using it) and then spent 3 years writing a really really really really st alternative to MFC that was useless, rather than just getting on with what they were supposed to be doing and making money. Ended up with a muppet application that looked like a kids activity centre.

Couldn't get out fast enough.

But yes, I would agree, why not just use a proper database that can be backed up whilst running, seems like the kind of requirement that would be a show stopped to me.

LeeThr

Original Poster:

3,122 posts

171 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.