Upload files to "OS/bash/Week3"
This commit is contained in:
parent
e27e2c7837
commit
a815332403
5 changed files with 56 additions and 0 deletions
18
OS/bash/Week3/q5.sh
Normal file
18
OS/bash/Week3/q5.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Enter the file extension"
|
||||
read ext
|
||||
|
||||
echo "Enter the destination folder"
|
||||
read dest
|
||||
|
||||
mkdir -p "$dest"
|
||||
|
||||
files=$(find . -maxdepth 1 -type f -name "*.$ext")
|
||||
echo "$files"
|
||||
|
||||
for file in $files; do
|
||||
cp "$file" "$dest"
|
||||
done
|
||||
|
||||
echo "Successfully copied files to target directory"
|
Loading…
Add table
Add a link
Reference in a new issue