Skip to main content
deleted 50 characters in body
Source Link
heemayl
  • 58.3k
  • 9
  • 129
  • 144

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use renameprename with find:

find . -type f -name '*\?*.mp4' -exec renameprename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

renameprename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. renameprename 's/\?/_/').

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

You can use prename with find:

find . -type f -name '*\?*.mp4' -exec prename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

prename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. prename 's/\?/_/').

deleted 286 characters in body
Source Link
heemayl
  • 58.3k
  • 9
  • 129
  • 144

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Also note that this will remove only the first occurrence of ? in the name, if you have multiple occurrences of ? and want to convert all of them to _, use rename with the g modifier:

find . -type f -name '*\?*.mp4' -exec rename 's:(.*/[^?]*)\?(.*$):$1_$2:g' {} +

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Also note that this will remove only the first occurrence of ? in the name, if you have multiple occurrences of ? and want to convert all of them to _, use rename with the g modifier:

find . -type f -name '*\?*.mp4' -exec rename 's:(.*/[^?]*)\?(.*$):$1_$2:g' {} +

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Added more info
Source Link
heemayl
  • 58.3k
  • 9
  • 129
  • 144

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?/_/(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Also note that this will remove only the first occurrence of ? in the name, if you have multiple occurrences of ? and want to convert all of them to _, use rename with the g modifier:

find . -type f -name '*\?*.mp4' -exec rename 's:(.*/[^?]*)\?/_/(.*$):$1_$2:g' {} +

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's/\?/_/' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Also note that this will remove only the first occurrence of ? in the name, if you have multiple occurrences of ? and want to convert all of them to _, use rename with the g modifier:

find . -type f -name '*\?*.mp4' -exec rename 's/\?/_/g' {} +

I have tested this in Ubuntu, in which rename (using debian alternatives system) is a perl script (prename), comes with perl package.

You can use rename with find:

find . -type f -name '*\?*.mp4' -exec rename -n 's:(.*/[^?]*)\?(.*$):$1_$2:' {} +

rename -n will show the files that will be renamed, if you are satisfied with that run the command with removing -n (i.e. rename 's/\?/_/').

Also note that this will remove only the first occurrence of ? in the name, if you have multiple occurrences of ? and want to convert all of them to _, use rename with the g modifier:

find . -type f -name '*\?*.mp4' -exec rename 's:(.*/[^?]*)\?(.*$):$1_$2:g' {} +
added 145 characters in body
Source Link
heemayl
  • 58.3k
  • 9
  • 129
  • 144
Loading
Source Link
heemayl
  • 58.3k
  • 9
  • 129
  • 144
Loading