Solved

Perl Scripting FTP lock

Posted on 2011-09-19
2
385 Views
Last Modified: 2012-05-12
Hello,

I have  a small PERL script that downloads files via FTP.  The issue is that this script locks the file while downloading meaning that the person on the other side can not write to it (it is a text file) while the script is downloading the file.

Can someone help unlock his file??
0
Comment
Question by:ilcapocamorra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
nemws1 earned 500 total points
ID: 36564727
That is typical behavior.  When a file is being read, it usually has a READ lock placed on it, so others can read it as well, but nobody can write to it.  If a file has a WRITE lock placed on it, nobody can read or write to it until the lock is cleared.

Usually in a case like this, I'll make a copy of the original file that can be read from while the original is free to be written to.

For example, if the file you're trying to download is named "log_file.1", make a copy of it on the server side named "log_file.1-downloadable".  Then your script can download it and take as much time as it wants.  The file "log_file.1" can still be written to on the server side.  After you are down downloading your copy, you can delete it (or request that it be deleted).

Of course, I don't know what/who is controlling the server you're accessing - they may not be willing to help set this up for you.
0
 

Author Closing Comment

by:ilcapocamorra
ID: 36575958
This solution works, but would like to be able to copy without having to put a read lock on the file but looks like I have to always :(
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question