Skip to content

Reset folders to default state ( permissions )

I have asked this question before, but i wrote it on paper and forgot how the command was. I have an old ntfs usb hdd that ive had some music on, and when i copy that, some folders have had executive permissions, some are completely wrong, i would like to recursively reset files and folders to their default state. Thanks in advance :)

2 points6 comments
Open on Reddit
About this post
Posted
Archived
Score
2 · 100% up
Kind
Text
ID
fbaed3

Author

62
posts
140
comments
10
media
View profile

6 comments

As in remove the executable flag? Some combination of chmod -R -x

https://www.gnu.org/software/coreutils/chmod

1 points

Yes, all the mp3 files are executable, some folders too so i cannot enter them. Someone had shared a really good command combo that i forgot that worked like magic

0 points

chmod -R u=rwX,go=rX Music/

Capital X stands for traversable (for directories) but not executable (for files)

4 points

it's the chmod -R command you want. if need be, you could search by file extension.

find . -type f -name "*.mp3" -exec chmod 644 {} ;

1 points

And how to go reverting directories to normal?

1 points

find . -type d -exec chmod nnn {} \; where nnn if the permissions for directory. probably 775. 664 for files with f instead of d.

. means current dir. So be at the root where you want to fix or specify with full directory. you can do d or f for files and directory. See the man page for more info.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.