Copy a file even if it already exist with unique name!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Aacini
Expert
Posts: 1926
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Copy a file even if it already exist with unique name!

#16 Post by Aacini » 26 Jan 2015 13:00

Squashman wrote:Hi Antonio,
I like your code. Short and sweet.
But can we really assume that the file with the newest time stamp has the highest number?
What happens when some one edits file 2 of 4.


But you could use the Creation date to force it back into order.


But maybe a better solution would be to just use an IF statement to compare all possibilities.


Of course there is only so much Human Error checking you can do. Some idiot could put the letter A inside the parentheses and A would become the largest value. If someone deletes the base file name from the backup folder the next time that file comes in, it would become the first base file name with no number.


foxidrive wrote:Antonio, your code relies on the files remaining static, is that right?

I made this comment earlier - the OP didn't reply though.

foxidrive wrote:What will happen to all these files? Will any of them ever be removed?
if you remove say file 5 then the code will need extra checking...


When a request have not enough specifications, I try to answer it via the simplest solution that fulfill the request as stated. If the OP have interest and reply with additional specifications then I evaluate a possible improvement of my code, but unfortunately this point not always happen. It is frequent that the OP never answer or just say "thanks" with no detail about how my code behaves. In this case, any effort made to improve the first solution was wasted time (and sam14189 had just proved this point)... :?

Antonio

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Copy a file even if it already exist with unique name!

#17 Post by Squashman » 26 Jan 2015 14:24

Aacini wrote:When a request have not enough specifications, I try to answer it via the simplest solution that fulfill the request as stated. If the OP have interest and reply with additional specifications then I evaluate a possible improvement of my code, but unfortunately this point not always happen. It is frequent that the OP never answer or just say "thanks" with no detail about how my code behaves. In this case, any effort made to improve the first solution was wasted time (and sam14189 had just proved this point)... :?

Antonio

I totally agree with you :!:

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy a file even if it already exist with unique name!

#18 Post by foxidrive » 29 Jan 2015 07:42

Aacini wrote:When a request have not enough specifications, I try to answer it via the simplest solution that fulfill the request as stated. If the OP have interest and reply with additional specifications then I evaluate a possible improvement of my code, but unfortunately this point not always happen.

Antonio

Yes, that's a friendly way to view it Antonio.

In my case after several thousand scripts where people don't reply, or they change the task, or didn't give correct details to start with, or argue when they don't have the skills in the first place...

I've learned to (usually) get the details before committing to code - because it's often a frustrating experience having to re-write your code.
This is doubly so when the person asking the question is unhelpful or otherwise treats you like a free code machine.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy a file even if it already exist with unique name!

#19 Post by foxidrive » 29 Jan 2015 08:43

foxidrive wrote:
Aacini wrote:When a request have not enough specifications, I try to answer it via the simplest solution that fulfill the request as stated. If the OP have interest and reply with additional specifications then I evaluate a possible improvement of my code, but unfortunately this point not always happen.

Antonio

Yes, that's a friendly way to view it Antonio.

After several thousand scripts where people don't reply, or they change the task, or didn't give correct details to start with, or argue when they don't have the skills in the first place...

I've learned to (usually) get the details before committing to code - because it's often a frustrating experience having to re-write your code.
This is doubly so when the person asking the question is unhelpful or otherwise treats you like a free code machine.

Aacini
Expert
Posts: 1926
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Copy a file even if it already exist with unique name!

#20 Post by Aacini » 29 Jan 2015 11:29

foxidrive wrote:In my case after several thousand scripts where people don't reply, or they change the task, or didn't give correct details to start with, or argue when they don't have the skills in the first place...

I've learned to (usually) get the details before committing to code - because it's often a frustrating experience having to re-write your code.
This is doubly so when the person asking the question is unhelpful or otherwise treats you like a free code machine.


Yes I understand that, but sometimes I try to guess the OP needs and post a "probable" solution for they, and now and then I do a hole in 1! Some time ago I tried to follow each change in OP's requests, but nowadays I just ignore they...

There is a popular phrase in México that describe this situation:


"La burra no era arisca, la hicieron a sombrerazos"


This site gives this translation:

"The she-donkey wasn´t ill-tempered, they made her so, beating her with hats"

A person who is distrustful and unfriendly most probably became that way by being treated abusively.

Antonio

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Copy a file even if it already exist with unique name!

#21 Post by Squashman » 29 Jan 2015 11:49

But why the feminine?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy a file even if it already exist with unique name!

#22 Post by foxidrive » 29 Jan 2015 18:20

Aacini wrote:There is a popular phrase in México that describe this situation:

"La burra no era arisca, la hicieron a sombrerazos"

"The she-donkey wasn´t ill-tempered, they made her so, beating her with hats"
A person who is distrustful and unfriendly most probably became that way by being treated abusively.

Antonio


It is true too :)

@Squashman: The gender is used in different languages for words and ideas and things. In German it's used that way also.

Post Reply