Last active
August 29, 2015 14:11
-
-
Save jack126guy/7ac23a5b40456c9d9c05 to your computer and use it in GitHub Desktop.
Fix files created with Windows path names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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