Solved

Perl Scripting FTP lock

Posted on 2011-09-19
2
341 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now