![]() |
Moving files linux to windows
First I would like to show my WORKING code:
Code:
# Append current date to all files |
Is /dir1/dir2/dir3/reports/dir4/dest_folder a remote or local directory? You should be able to see its disk space usage using the df command.
|
76% used. It's a remote Windows shared folder
|
It all started with the so called maintenance done, then I was not able to 'rm' an archive file. Now everything works BUT it only moves the biggest file
|
Can you move the other files manually? It probably is something the sysadmins changed.
|
If done manually yes I can move everything just fine. I was just told they did some patching
|
I feel what might be useful here is to see more data, on the data. Debug mode for the script as it finds files because perhaps there's a new issue which is causing only certain files to be found. Then additional information on the input and expected output. Which is to say, "new files are xxxx, yyyy, zzzz, and their sizes are .... (for instance show an ls -l output of it all), and then cite what is supposed to happen, and finally describe what did happen.
I realize you did say this, however you said it in general versus using the specific data, or some edited representation of the data so as to not reveal information you have to protect. |
Well it's only .xlsx files in a current dated folder. I'm using Oracle EDQ to create these reports and send them to a shared Windows folder. For a week everything was working ok until the sysadmins did some patching. I am very reluctant to change ANY of my code since it was working ok until THEY did some patching. Yes because of my job I can't really give all the info, but I did my best to provide you with a clear picture of what is happening. I feel things just dont happen for a week then all of the sudden mess up.I think it's clear that whatever 'patching' they did messed things up. If you look at my comments in my code, if someone would like to provide more efficient code Im open to that too
|
My point is that the commands likely are not affected too much by their upgrades. In fact, their upgrades were to Windows, correct?
Your script, correct me on this point, is run by Linux or cygwin running attached to this drive or machine? Either case, the script fundamentals are very simple: for loop, ls command, mv command, chmod command. Therefore the directory structure is a possible item in question. As I cited, it is sometimes difficult to give true examples, however there are a few ways I'd approach this, and they go back to the same recommendations for when you developed your script:
|
My point is that the commands likely are not affected too much by their upgrades. In fact, their upgrades were to Windows, correct?.....This is correct
Your script, correct me on this point, is run by Linux or cygwin running attached to this drive or machine?.....It is ran by Linux Out of curiosity, why would the directory structure cause an issue? |
I have no idea what "//dir1/dir2/dir3/reports/dir4/dest_folder" represents, except that you physically have the directory structure named: //dir1/dir2/dir3/reports/dir4/dest_folder
Why is there a double // before all that? I do not feel it is required, unless this is something you've already tested and discovered that it was required? |
I have plenty of issues with the script as it stands, but as that is a second issue, please follow the suggestion of using set-xv to get output which can be diagnosed.
|
@grain...what issues do you have with the script??? Can you please provide some code that would be better?
|
From the top of my head:
Using a "for ls " combination is never a good idea: http://mywiki.wooledge.org/BashPitfa...8ls_.2A.mp3.29 The command date is in the loop, which means the time can change during the loop I would test if the folder exists already, before you create it I would always make the script exit, if a mkdir or mv fails (like in "mkdir foobar || exit"). I would use ParameterExpansion. http://mywiki.wooledge.org/BashFAQ/0...meterExpansion --- Not saying such is better or something is wrong. Only saying what comes to my mind. I fiddled a bit with it, but can't test it well. I am beginner. Anyway here would be my approach, but on a pastebin site (so it doesn't look like a proposed solution). Don't get me wrong, don't be angry at me. :-) Only ideas. Look at it, perhaps it contains useful for you. Else ignore http://paste.debian.net/909737/ |
@nodir...You are no beginner posting suggestions like that. I am the beginner.
Can someone please post code that would do the same as my code above, but better. I am a beginner and the only way I got to the code I provided was by help from someone else on this site which was working just fine. I've ran out of ideas. Meanwhile Ill do the 'set -xv' suggestion. |
All times are GMT -5. The time now is 12:08 AM. |