Hidden Files Not Being Copied On Mac with cp -r - linux

Very very weird issue. I have a project that has hidden files on Mac OS 12.2.1, I am try to copy over. For example:
drwxr-xr-x 16 john staff 512 Jun 25 10:35 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r--# 1 john staff 6148 Jun 5 13:52 .DS_Store
drwxr-xr-x 14 john staff 448 Jun 26 20:29 .git
-rw-r--r-- 1 john staff 310 Jun 4 09:52 .gitignore
-rw-r--r-- 1 john staff 368 Jun 4 10:15 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 20 15:29 README.md
drwxr-xr-x 8 john staff 256 Jun 24 16:49 build
-rw-r--r-- 1 john staff 217 Jun 4 10:16 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 25 14:31 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 25 14:31 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 25 14:31 package.json
-rw-r--r-- 1 john staff 82 Jun 4 10:30 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 5 14:00 public
drwxr-xr-x 18 john staff 576 Jun 20 13:42 src
-rw-r--r-- 1 john staff 2836 Jun 5 02:36 tailwind.config.js
Now I run the following command
sudo cp -R * ../otherfolder
And I've also tried a variation
cp -r * ../otherfolder
And the following is there:
drwxr-xr-x 13 john staff 416 Jun 27 07:54 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r-- 1 john staff 368 Jun 27 07:54 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 27 07:54 README.md
drwxr-xr-x 8 john staff 256 Jun 27 07:54 build
-rw-r--r-- 1 john staff 217 Jun 27 07:54 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 27 07:54 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 27 07:54 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 27 07:54 package.json
-rw-r--r-- 1 john staff 82 Jun 27 07:54 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 27 07:54 public
drwxr-xr-x 18 john staff 576 Jun 27 07:54 src
-rw-r--r-- 1 john staff 2836 Jun 27 07:54 tailwind.config.js
None of the invisible files with a period in front have NOT been copied over. Any ideas?

cp -rpv . /path/to/other/folder/

Related

Node.JS Org-scoped package - error when 'require()'

Context: Node.JS
I am having an error invoking 'require()' for an ORGANIZATION-SCOPED Package (from NodeJS.com)
$ pwd
/Users/Sarma
$ node
> module.paths
[ '/Users/Sarma/repl/node_modules',
'/Users/Sarma/node_modules',
'/Users/node_modules',
'/node_modules',
'/usr/local/lib/node_modules',
'/Users/Sarma/.node_modules',
'/Users/Sarma/.node_libraries',
'/usr/local/Cellar/node/10.2.1/lib/node' ]
> require('#asux.org/cli-npm')
Error: Cannot find module '#asux.org/cli-npm'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
Any Tips on how to solve this?
To investigate myself, I searched '/' for 'loader.js' and found nothing (other than under XCode and VSC).
$ pwd
/Users/Sarma
$ ls -la node_modules
total 0
drwxr-xr-x 12 Sarma staff 384 Apr 6 22:22 .
drwxr-xr-x+ 72 Sarma staff 2304 Apr 6 22:22 ..
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 .bin
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 #asux.org
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 #types
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 ansi-styles
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 chalk
drwxr-xr-x 9 Sarma staff 288 Apr 6 22:22 color-convert
drwxr-xr-x 6 Sarma staff 192 Apr 6 22:22 color-name
drwxr-xr-x 8 Sarma staff 256 Apr 6 22:22 commander
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 has-flag
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 supports-color
$ ls -la node_modules/#asux.org/cli-npm
total 32
drwxr-xr-x 8 Sarma staff 256 Apr 6 22:22 .
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 ..
-rw-r--r-- 1 Sarma staff 3834 Oct 26 1985 HISTORY
-rw-r--r-- 1 Sarma staff 1516 Oct 26 1985 LICENSE
drwxr-xr-x 5 Sarma staff 160 Apr 6 22:22 bin
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 node_modules
-rw-r--r-- 1 Sarma staff 375 Apr 6 22:22 package-lock.json
-rw-r--r-- 1 Sarma staff 2100 Apr 6 22:22 package.json
Thanks in advance!
In package.json..
I was missing the obvious (in hindsight).
"main": "bin/asux_module.js",
Once I added it, require() was successful.

Shell script to ls and execute command on ls result

I have a list of folders inside a folder in ubuntu.
ie.
Under /mnt/source/customcode/files/brands/
root#a919794ec280:/mnt/source/customcode/files/brands# ls -la
total 236
drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 .
drwxrwxrwx 8 1002 1003 4096 Dec 27 22:45 ..
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 aem
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 apple
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 cool
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 doll
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 ent
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 f1
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 google
drwxrwxrwx 3 1002 root 4096 Jan 3 09:22 h1
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 iq
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 king
drwxrwxrwx 3 root root 4096 Jan 3 09:22 link
drwxrwxrwx 3 1002 root 155648 Jan 3 09:22 nobrand
drwxrwxr-x 3 1002 1003 12288 Jan 3 09:22 pepperfry
drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 pepsi
drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 rock
drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 star9
drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 vicks
----- 100+ -----
Like above, I have folders like "a1", "cola", "link" and etc. (more then 100 folders)
In side those each folders there will be a folder named "data_aug" and "data_aug" folder do contain files inside.
root#a919794ec280:/mnt/source/customcode/files/brands/apple# ls -la
total 1988
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 .
drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 ..
-rw-r--r-- 1 1002 1003 17465 Dec 29 23:28 0DPA0C3.jpg
-rw-r--r-- 1 1002 1003 3836 Dec 31 00:55 130418131111-apple-store-santa-monica.jpg
-rw-r--r-- 1 1002 1003 48616 Dec 31 00:52 15146774227434507677123475441338.jpg
-rw-r--r-- 1 1002 1003 9107 Dec 31 00:52 15146774615326659565665852728294.jpg
-rw-r--r-- 1 1002 1003 28005 Dec 29 23:28 3D-Apple-Logo-Wallpapers.jpg
-rw-r--r-- 1 1002 1003 75855 Dec 29 23:28 3D-Apple-Logo.jpg
-rw-r--r-- 1 1002 1003 27403 Dec 29 23:28 3d_apple_logo___wallpaper_by_techflashdesigns-d4fbc7p.jpg
-rw-r--r-- 1 1002 1003 38420 Dec 29 23:28 AX62GjL.jpg
-rw-r--r-- 1 1002 1003 6025 Dec 29 23:28 Apple-Logo-2016 (1).jpg
-rw-r--r-- 1 1002 1003 929419 Dec 29 23:28 Apple-Logo-Png-Download.png
-rw-r--r-- 1 1002 1003 35742 Dec 29 23:28 apple-logo-2016.jpg
-rw-r--r-- 1 1002 1003 15301 Dec 29 23:28 apple-logo-3d-model-max-obj-fbx-3dm-ige-igs-iges.jpg
-rw-r--r-- 1 1002 1003 42514 Dec 29 23:28 apple-logo-clipart-2.jpeg
-rw-r--r-- 1 1002 1003 152183 Dec 29 23:28 apple-logo-clouds.jpg
-rw-r--r-- 1 1002 1003 6117 Dec 31 00:55 apple1.jpg
-rw-r--r-- 1 1002 1003 349787 Dec 29 23:28 apple_ipad_logo.png
-rw-r--r-- 1 1002 1003 54167 Dec 29 23:28 b5c4d6c9-3.jpg
drwxr-xr-x 2 root root 4096 Jan 3 09:22 data_aug
-rw-r--r-- 1 1002 1003 32918 Dec 29 23:28 large.JPG
-rw-r--r-- 1 1002 1003 48972 Dec 29 23:28 medium.jpg
-rw-r--r-- 1 1002 1003 3609 Dec 29 23:28 th (1).jpeg
-rw-r--r-- 1 1002 1003 30392 Dec 29 23:28 th (2).jpeg
-rw-r--r-- 1 1002 1003 3222 Dec 29 23:28 th.jpeg
-rw-r--r-- 1 1002 1003 22544 Dec 29 23:28 u5TAcBk.jpg
root#a919794ec280:/mnt/source/customcode/files/brands/apple/data_aug# ls -la
total 4356
drwxr-xr-x 2 root root 12288 Jan 3 09:41 .
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 ..
-rw-r--r-- 1 root root 10450 Jan 3 09:40 apple_0_1.jpeg
-rw-r--r-- 1 root root 5599 Jan 3 09:40 apple_0_1019.jpeg
-rw-r--r-- 1 root root 3225 Jan 3 09:40 apple_0_1075.jpeg
-rw-r--r-- 1 root root 10283 Jan 3 09:40 apple_0_1100.jpeg
-rw-r--r-- 1 root root 13923 Jan 3 09:41 apple_0_1119.jpeg
Now...
I need a script to be placed in "/mnt/source/customcode/"
Want to run the script from "/mnt/source/customcode/" as my script dependent files are can only be executed from "/mnt/source/customcode/"to achieve bellow.
Delete the folder "data_aug" and the data inside "data_aug"
recursively from all the 100 folders.
Then from the "/mnt/source/customcode/" location I should execute a
special script which, it will refer those 100 folders. like example
below.
Code...
python -m scripts.augmentation_keras --image_dir=files/brands/apple --target_dir=files/brands/apple/data_aug --save_prefix=apple
python -m scripts.augmentation_keras --image_dir=files/brands/a1 --target_dir=files/brands/a1/data_aug --save_prefix=a1
like above for all the 100 folders. The number of folders 100 will grow more in future.
How can I do it dynamically instead of writing simple script with hundreds of lines (static deletion and execution)!
Thanks.
Probably something like this:
for d in /home/user/data/*
do
rm -rf $d/content/*
python -m scripts.augmentation_keras --image_dir=$d --
target_dir=$d/content --save_prefix=$(basename $d)
done

topojson command not added on npm install

I am getting an error when using topojson saying that the command cannot be found. I think the install has gone OK but there just isn't a command for topojson, but there are ones for topo2geo, topomerge etc. I'm using nvm if that is relevant and on mac.
Some Node details:
Grahams-MacBook-Air:data grahamfletcher$ ls -l /Users/grahamfletcher/.nvm/versions/node/v7.10.0/lib/node_modules/
total 0
drwxr-xr-x 3 grahamfletcher staff 102 14 Jul 22:01 #angular
drwxr-xr-x 7 grahamfletcher staff 238 10 Oct 02:58 create-react-app
drwxr-xr-x 11 grahamfletcher staff 374 14 Jul 23:35 eslint
drwxr-xr-x 18 grahamfletcher staff 612 25 Jul 01:34 nodemon
drwxr-xr-x 25 grahamfletcher staff 850 3 May 2017 npm
drwxr-xr-x 13 grahamfletcher staff 442 22 Nov 13:00 ogr2ogr
drwxr-xr-x 11 grahamfletcher staff 374 22 Nov 14:42 topojson
topojson is there, but...
Grahams-MacBook-Air:data grahamfletcher$ ls -l /Users/grahamfletcher/.nvm/versions/node/v7.10.0/bin
total 69760
lrwxr-xr-x 1 grahamfletcher staff 45 10 Oct 02:58 create-react-app -> ../lib/node_modules/create-react-app/index.js
lrwxr-xr-x 1 grahamfletcher staff 40 14 Jul 23:35 eslint -> ../lib/node_modules/eslint/bin/eslint.js
lrwxr-xr-x 1 grahamfletcher staff 70 15 Nov 11:10 geo2topo -> ../lib/node_modules/topojson/node_modules/topojson-server/bin/geo2topo
lrwxr-xr-x 1 grahamfletcher staff 39 14 Jul 22:01 ng -> ../lib/node_modules/#angular/cli/bin/ng
-rwxr-xr-x 1 grahamfletcher staff 35672760 3 May 2017 node
lrwxr-xr-x 1 grahamfletcher staff 42 25 Jul 01:34 nodemon -> ../lib/node_modules/nodemon/bin/nodemon.js
lrwxr-xr-x 1 grahamfletcher staff 38 3 May 2017 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 grahamfletcher staff 70 15 Nov 11:10 topo2geo -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topo2geo
lrwxr-xr-x 1 grahamfletcher staff 71 15 Nov 11:10 topomerge -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topomerge
lrwxr-xr-x 1 grahamfletcher staff 74 15 Nov 11:10 topoquantize -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topoquantize
lrwxr-xr-x 1 grahamfletcher staff 76 15 Nov 11:10 toposimplify -> ../lib/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify
No topojson here??
My path, which is saying something about a valid identifier. Is this an issue?
Grahams-MacBook-Air:data grahamfletcher$ export $PATH
-bash: export: `/Library/Frameworks/GDAL.framework/Programs:/opt/local/bin:/opt/local/sbin:/Users/grahamfletcher/.nvm/versions/node/v7.10.0/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands': not a valid identifier

How do I select a specific block of text in vim?

These are the contents in my file
-r-xr-xr-x 1 dinesh eng 29072 Aug 26 2004 config.sub
-r-xr-xr-x 1 dinesh eng 38515 Aug 26 2004 config.guess
-r-xr-xr-x 1 dinesh eng 5643 Aug 26 2004 install-sh
-r-xr-xr-x 1 dinesh eng 767 Aug 26 2004 mkinstalldirs
-r-xr-xr-x 1 dinesh eng 6328 Aug 26 2004 missing
-r-xr-xr-- 1 dinesh eng 440 Aug 27 2004 build.sh
-r--r--r-- 1 dinesh eng 975 Apr 2 2015 Makefile.am
-r--r--r-- 1 dinesh eng 1153 Apr 2 2015 configure.ac
-r-xr-xr-- 1 dinesh eng 952 Apr 2 2015 autogen.sh
drwxrwxr-x 4 dinesh eng 4096 Nov 30 2016 Scripts
lrwxrwxrwx 1 dinesh eng 35 Dec 1 2016 ltmain.sh -> /usr/share/libtool/config/ltmain.sh
-rw-rw-r-- 1 dinesh eng 2801 Dec 1 2016 config.h.in
lrwxrwxrwx 1 dinesh eng 32 Dec 1 2016 depcomp -> /usr/share/automake-1.11/depcomp
drwxrwxr-x 7 dinesh eng 4096 Dec 1 2016 install
-rw-rw-r-- 1 dinesh eng 41966 Feb 14 00:30 aclocal.m4
drwxr-xr-x 2 dinesh eng 81 Feb 14 00:30 autom4te.cache
-rwxrwxr-x 1 dinesh eng 606261 Feb 14 00:30 configure
drwxrwxr-x 3 dinesh eng 4096 Feb 14 00:30 bin
drwxrwxr-x 3 dinesh eng 53 Feb 14 00:30 preinstall
drwxrwxr-x 4 dinesh eng 4096 Feb 14 00:30 share
drwxrwxr-x 7 dinesh eng 97 Feb 14 00:30 test
-rw-rw-r-- 1 dinesh eng 26776 Feb 14 00:30 Makefile.in
drwxrwxr-x 9 dinesh eng 4096 Feb 14 00:31 build
-rw-rw-r-- 1 dinesh eng 10 Feb 14 00:35 stamp-h.in
drwxrwxr-x 3 dinesh eng 4096 Feb 23 09:25 conf
drwxrwxr-x 2 dinesh eng 4096 Apr 3 01:34 SCCS
drwxrwxr-x 4 dinesh eng 4096 Apr 3 01:34 doc
drwxrwxr-x 5 dinesh eng 12288 Apr 3 01:48 lib
drwxrwxr-x 3 dinesh eng 4096 Apr 3 01:48 src
drwxrwxr-x 8 dinesh eng 79 Jun 9 02:58 BitKeeper
i want to select and delete all the junk information except for the name of the file in one shot from vim. How can I do it?
With :help :normal and a simple normal mode command:
:%normal! d8W
Which means "on every line in the buffer, delete until the 8th WORD".
With a substitution:
:%s/^\(\S\+\s\+\)\{8}
Which means "substitute every sequence of height groups made of one or more non-whitespace characters followed by one or more white-space characters, starting from the beginning of the line".
Just select the block with Ctrl-v and delete it with d.
Hey VIM support virtual block mode.
In which you have choice of columnar selection of data.
1: Open you file using vim, press Ctrl+v.
2: Select all columns you wanna delete and press d.
3: To save file and exit press :wq
Give the following command:
:1,$s/.* //g

Quit hidden attribute to many files in a directory once in UNIX

Hello Everybody there.
I wanna know if there is a command of set of commands (maybe a pipeline set) which can be used to change the hidden attribute of many files stored in a particular directory, with the same name.
ie.
ls -la inside torrents/music/david_guetta_greatest_hits shows the next files:
drwxrwxrwx 20 crsuarez staff 680 Apr 9 19:25 .
drwxrwxrwx 20 crsuarez staff 680 Apr 9 19:11 ..
-rw-r--r-- 1 crsuarez staff 6894561 Apr 9 19:16 .I'm Famous.wma
-rw-r--r-- 1 crsuarez staff 7543777 Apr 9 19:16 .Gettin Over.wma
-rw-r--r-- 1 crsuarez staff 6378465 Apr 9 19:16 .I Gotta Feeling.wma
-rw-r--r-- 1 crsuarez staff 7245793 Apr 9 19:16 .In love with myself.wma
-rw-r--r-- 1 crsuarez staff 7060449 Apr 9 19:16 .It's the Way You Love Me.wma
-rw-r--r-- 1 crsuarez staff 7737313 Apr 9 19:16 .Love Don't Let Me Go.wma
-rw-r--r-- 1 crsuarez staff 7737313 Apr 9 19:16 .Love is Gone.wma
-rw-r--r-- 1 crsuarez staff 6628321 Apr 9 19:16 .Memories.wma
-rw-r--r-- 1 crsuarez staff 7525345 Apr 9 19:16 .Money.wma
-rw-r--r-- 1 crsuarez staff 7806945 Apr 9 19:16 .One Love.wma
-rw-r--r-- 1 crsuarez staff 7192545 Apr 9 19:16 .Sexy Bitch.wma
-rw-r--r-- 1 crsuarez staff 6954977 Apr 9 19:16 .Stay.wma
-rw-r--r-- 1 crsuarez staff 8025057 Apr 9 19:16 .The World is Mine.wma
-rw-r--r-- 1 crsuarez staff 7769057 Apr 9 19:16 .TitaniuM.wma
-rw-r--r-- 1 crsuarez staff 6693857 Apr 9 19:16 .Turn ME ON.wma
-rw-r--r-- 1 crsuarez staff 7215073 Apr 9 19:16 .When Love Takes Over.wma
-rw-r--r-- 1 crsuarez staff 8182753 Apr 9 19:16 .Without YoU.wma
I wanna unhide all of this files with a single set of commands (I don't care if I have to use pipeline), instead of use mv .hidden_file_name not_hidden_file_name.
The solution must be OSX Complain. ;)
Something like this
for origname in .[0-9A-Za-z]*
do
if [ -f "${origname}" ]; then
# compute your newname how you want it
mv "${origname}" "${newname}
fi
done
You'll have to decide what you want your new names to be - you'll strip off the leading dot '.' but doing only what will probably collide with an existing .wma file with the same name, so maybe also append .tmp -- like:
.One Love.wma --becomes--> One Love.wma.tmp
Use prename (rename on Debian-derived systems).
prename 's/^.//' .*.wma

Resources