Showing posts with label File Automation Script. Show all posts
Showing posts with label File Automation Script. Show all posts

Wednesday, August 16, 2023

File Automation Script

 #!/bin/sh
 
echo "Enter file name: "
read file
if test -e ${file}
then
select user in empty directory readable writable
do
        case ${user} in
                "empty")
                        if test -s ${file}
                        then
                                echo "${file}-->is not empty"
                        else
                                echo "${file}-->is empty"
                        fi
                        ;;
                "directory")
                        if test -d ${file}
                        then
                                echo "${file}-->is a directory"
                        else
                                echo "${file}-->is not a directory"
                        fi
                        ;;
                "readable")
                        if test -r ${file}
                        then
                                echo "${file}-->is readable"
                        else
                                echo "${file}-->is not readable"
                        fi
                        ;;
                "writable")
if test -w ${file}
                        then
                                echo "${file}-->is writable"
                        else
                                echo "${file}-->is not writable"
                        fi
                        ;;
                "executable")
                        if test -x ${file}
                        then
                                echo "${file}-->is executable"
                        else
                                echo "${file}-->is not executable"
                        fi
                        ;;
        esac
done
else 
    echo "${file}-->not found"
fi


*********************************************************************
stat file.txt
  File: file.txt
  Size: 1               Blocks: 8          IO Block: 4096   regular file
Device: ch/12d  Inode: 229149      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-08-17 11:26:26.803000000 +0530
Modify: 2023-08-17 11:26:26.803000000 +0530
Change: 2023-08-17 11:26:26.803000000 +0530
 Birth: -

Enable OpenSSH on Windows 11

Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...