Unzip file and give permissions (UNIX, Solaris) - unix

How could we unzip file and give (rwx) permissions to files and directories inside .zip file in Solaris?
unzip -d
It should be done in one command.
Not first unzip and then chmod -R +rwx

Related

Enter multiple directories, enter subdirectories, and move all files up one directory with bash

I have multiple directories like:
T1_5356
T1_5357
T1_5358
.
.
Each directory has a sub-directory called DTI
I would like to enter each directory and copy the contents of its respective DTI contents up one directory (so cp T1_5356/DTI/* ../)
I have been trying variations of:
for dir in T1*; do cd $dir; cp -r DTI/*; cd ../; done
but I get an error:
cp: cannot stat `DTI/*': No such file or directory
from inside the directory that contains all the T1_* directories:
for dir in T1_*; do cp $dir/DTI/* $dir; done

How do I ls a directory to get it's data, but none of its files?

I wish to run ls -alh on a directory, so that I can get when the directory was last modified.
I do NOT want to get the ls information for the files in that directory, just that directory.
Is this possible?
Turn's out it's easy
ls -alhd
The -d flag reports on directories, not their files

Unzip gives me file path for filename

When I run unzip dir.zip and ls -l the result,
I got:
widgets\Draw\setting\nls\et\strings.js
I expect:
widgets
The zip is generated on windows with nodejs.
Thanks

cp:omitting directory 'off_web' when I copy my project

In my computer, I want to backup the project, so I copy:
cp off_web off_web_bak_20171008
But it give the below error:
cp:omitting directory 'off_web'
You try the below command:
cp -r off_web off_web_bak_20171008
This error when you execute cp command means under the off_web directory, there are still have directory under the off_web, use -r will recursive copy the project.

Make zip of directory contents and name zip same as directory - recursively

I have over 500 sub directories coming off of one root directory that each contain >6000 files each. the directories are named 20150218, 20150217, etc., one for each day of the year.
I want to develop a script that will zip all of the files in a directory, i.e. 20150217 and name the directory 20150217.zip. I then want to delete the original files.
so, all of the sud directories in ~/public_html/ispy/dlink/ would be zipped separately.
I appreciate any guidance.
Copy and paste following script into any unix editor (vim, geany, mousepad) and save it in directory with Your "date" subfolders. Name it as you wish, with no extension e.g. zipscript. From terminal: go to directory with Your script, allow to execute it: chmod +x zipscript and fire it: sudo ./zipscript.
#!/bin/bash
for D in *
do
if [ -d "${D}" ]; then
zip -r -j "${D}".zip "${D}"
rm -R "${D}"
fi
done
Script runs as follows: for every file (directory is also a file under unix) in current directory check if it is a directory and, if true, make zip with the same name, then delete subdirectory with all files in it.

Resources