Changeset 349 for misc


Ignore:
Timestamp:
Dec 6, 2011, 7:55:09 PM (13 years ago)
Author:
Rick van der Zwet
Message:

Make it actually do something..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • misc/music-files-sanitize.py

    r297 r349  
    2525parser.add_argument('directories', nargs='+', metavar='DIR', type=str)
    2626args = parser.parse_args()
     27
     28print "# INFO: Going to parse directories %s" % args.directories
    2729
    2830trans_table = {
     
    7476  return str(dest)
    7577
    76 for root, dirs, files in os.walk(sys.argv[1],topdown=False):
    77   for file in files + dirs:
    78     new_file = make_ascii(file)
    79     if new_file != file:
    80       source = os.path.join(root,file)
    81       target = os.path.join(root,new_file)
    82       prefix = '# (dryrun) ' if args.dryrun else ''
    83       print prefix, "Source:", source
    84       print prefix, "Target:", target
    85       if not args.dryrun:
    86         os.rename(source,target)
     78for dir_root in args.directories:
     79  for root, dirs, files in os.walk(dir_root,topdown=False):
     80    for file in files + dirs:
     81      new_file = make_ascii(file)
     82      if new_file != file:
     83        source = os.path.join(root,file)
     84        target = os.path.join(root,new_file)
     85        prefix = '# (dryrun) ' if args.dryrun else ''
     86        print prefix, "Source:", source
     87        print prefix, "Target:", target
     88        if not args.dryrun:
     89          os.rename(source,target)
Note: See TracChangeset for help on using the changeset viewer.