Skip to content

Instantly share code, notes, and snippets.

@jack126guy
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jack126guy/7ac23a5b40456c9d9c05 to your computer and use it in GitHub Desktop.
Save jack126guy/7ac23a5b40456c9d9c05 to your computer and use it in GitHub Desktop.
Fix files created with Windows path names
#!/usr/bin/perl
#Instructions: On a Unix-like system, run: find [basedir] -type f | perl fixdirs.pl
#This script is in the public domain (http://creativecommons.org/publicdomain/zero/1.0/)
use strict;
use File::Path 'make_path';
use File::Copy 'copy';
my ($dn, $fn);
while(<STDIN>) {
chomp;
($dn, $fn) = m/(.*)\\([^\\]*)/;
$dn =~ s/\\/\//g;
make_path $dn;
copy($_, $dn . '/' . $fn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment