Today, I was faced with Dropbox 'Error 36' on MacOS.
So, let's start from beginning... Dropbox has file name limitations, and those limitations are a bit different than operating system limitations (MacOSX).
I am convinced that there are good reasons for these, as they have special meaning on the command line level or would look really weird in the browser.
Let's start with the issues:
- Issue 1: File names can not start or end with blank character
- Issue 2: File names should not contain slashes
Where issue 2 is easy to spot, finder does not make it easy to spot issue 1. Thus I have created a short script that fixes blank characters in file names.
You can download dropbox_fix_script.pl. You need to navigate to the folder you are trying to copy, unzip and run this script from terminal.
Before you run this script, make sure to backup your data.
If there are enough interested readers, I may wrap this into application that you can drop a folder on.
--- script content is:
#!/usr/bin/env perl
#
sub fix()
{
my @list = `find .` ;
chomp(@list);
for my $file (@list)
{
print "." ;
my $base = `basename "$file"` ;
my $dir = `dirname "$file"` ;
chomp($base);
chomp($dir);
if( ($base =~ /\s+$/) || ($base =~ /^\s+/) || ($base =~ /\// )
{
print "match $file\n" ;
$base =~ s/\s+$//mig ;
$base =~ s/^\s+//mig ;
$base =~ s/\//_/mig ;
print "\n" ;
return ( $file, "$dir/$base");
}
}
return undef;
}
while( 1 )
{
my ($file, $new_file) = &fix();
if( defined( $file ) )
{
print "rename '$file' '$new_file'\n" ;
if( -f $new_file )
{
print "file already exists $new_file -- fix $file \n" ;
exit ;
}
if( -d $new_file )
{
print "dir already exists $new_file -- fix $file \n" ;
exit ;
}
rename $file , $new_file ;
}
else
{
last;
}
}
Monday, February 7, 2011
Dropbox (Error code -36)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment