Skip to main content

A module to Handle all file / directory activities for automation

Project description

FileActivityHandler

This module is designed to handle file / directory related checks. If you are doing some automation no need to write code from scratch all are taken care within this module.


Advantage

  1. Easy to use
  2. Concise code
  3. Reduces developer effort from re-writing code from scratch

Functions available within module

  • checkPathExistorNot( PATH )
  • checkFileExistorNot( PATH with filename )
  • checkFileExtensionExistorNot( PATH with filename )
  • checkFileSize(PATH with filename)
  • monitorFilearrival(PATH with filename)
  • getFileExtension(PATH with filename)
  • getFileName(PATH with filename)
  • copyFileA2BPath(SourcePath="", DestinationPath="", fileName="")

How to import fileactivityhandler module

import fileactivityhandler

How to use function : checkPathExistorNot( PATH ) within the program


This fucntion will return TRUE or None. If it returns TRUE then the PATH is present and it's valid PATH. If it returns None means the given PATH does not exist or it's a invalid PATH.


import fileactivityhandler

status=fileactivityhandler.checkPathExistorNot(r"C:\Users\vvoor\Desktop\Python")

print('Your status : ',status)

To perform status check on checkPathExistorNot


import fileactivityhandler 

status=fileactivityhandler.checkPathExistorNot(r"C:\Users\vvoor\Desktop\fileActivityHandlers")

if status is True:
    print('Success')
else:
    print('Fail')

How to use function : checkFileExistorNot( PATH with filename ) within the program

import fileactivityhandler 

status=fileactivityhandler.checkFileExistorNot(r"C:\Users\vvoor\Desktop\fileActivityHandlers\demo.txt")

if status is True:
    print('Success')
else:
    print('Fail')

How to use function : checkFileExtensionExistorNot( PATH with filename ) within the program

import fileactivityhandler 

status=fileactivityhandler.checkFileExtensionExistorNot(r"C:\Users\vvoor\Desktop\Temp\data.json")

if status is True:
  print('Succes')
else:
  print('Fail')

How to use function : checkFileSize( PATH with filename ) within the program

import fileactivityhandler

status=fileactivityhandler.checkFileSize(r"C:\Users\vvoor\Desktop\Temp\data.json")

if status is True:
  print('Succes')
else:
  print('Fail')

How to use function : monitorFilearrival( PATH with filename ) within the program

import fileactivityhandler

status=fileactivityhandler.monitorFilearrival(r"C:\Users\vvoor\Desktop\Temp\data.json")

if status is True:
  print('Succes')
else:
  print('Fail')

How to use function : getFileExtension( PATH with filename ) within the program

import fileactivityhandler

varname=fileactivityhandler.getFileExtension(r"C:\Users\vvoor\Desktop\Temp\data.json")

if varname is None:
  print('No extesnion')
else:
  print('File extesnion : ',varname)

How to use function : getFileName( PATH with filename ) within the program

import fileactivityhandler

varname=fileactivityhandler.getFileName(r"C:\Users\vvoor\Desktop\Temp\data.json")

if varname is None:
  print('Fail')
else:
  print('File name : ',varname)


How to use function : copyFileA2BPath(SourcePath="",DestinationPath="",fileName="") within the program

import fileactivityhandler

status=fileactivityhandler.copyFileA2BPath(r"C:\Users\vvoor\Desktop\Temp\folder_A",r"C:\Users\vvoor\Desktop\Temp\folder_B","data.json")

if status is True:
  print('File copied')
else:
  print('Fail to copy file')


Note : Depending upon status you can decide either to continue or terminate the code from executing further Logic by using sys.exit() by importing sys module as import sys


Change Log


Version : 0.0.1 R1 (09-APRIL-2022)

  • First Release

LICENSE

Copyright 2022 Vikas Bhaskar Vooradi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fileactivityhandler-0.0.1.post1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file fileactivityhandler-0.0.1.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for fileactivityhandler-0.0.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 27d6e7bd8fea7cd1882d40d31e4ba604bb4cbcb9f843d5de6a2c74ac884b25fd
MD5 83f92a34f7b80240fe138947f3a0e1e3
BLAKE2b-256 be1c8ba94e341a55d0841b78b907c6856ac080fca7bd8513a259a9dc1e960cec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page