Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #usr/bin/share/python
- #script codded by tanmay for all facebook and HF friends :)
- import shutil #function for system commands like copy,move etc
- import sys #for exit code and sys func
- from os import * #access to all os func
- def move_folder():
- folder_to_move=raw_input("Folder to Move :$: ")
- dest=raw_input("Location Where Move :$: ")
- print '\n'
- try:
- shutil.move(folder_to_move,dest)
- print '%s Moved Successfully To %s' %(folder_to_move,dest)
- print '\n'
- start()
- except:
- print 'Possible Errors will be : \n'
- print 'System Cannot find path specified'
- print 'Folder not exist'
- raw_input('Press Enter To Restart')
- start()
- def move_file():
- file_to_move = raw_input('File to move :$: ')
- dest_file=raw_input('Location where move :$: ')
- print '\n'
- try:
- shutil.move(file_to_move,dest_file)
- print '%s Moved Successfully To %s'%(file_to_move,dest_file)
- print '\n'
- start()
- except:
- print 'Possible Errors Will be : \n'
- print 'System Cannot find the path specified'
- print 'File not exist'
- raw_input('Press Enter To Restart')
- start()
- def del_fold():
- fold_to_del = raw_input('Folder to delete :$: ')
- try:
- rmdir(fold_to_del)
- start()
- except WindowsError as msg:
- print 'Error : %s' %msg[1]
- raw_input('Press Enter To Restart')
- start()
- def del_file():
- file_to_del = raw_input('File to delete :$: ')
- try:
- remove(file_to_del)
- start()
- except OSError as msg:
- print 'Error : %s'%msg[1]
- print '\n'
- raw_input('Press Enter To Restart')
- start()
- def create_folder():
- new_folder_name = raw_input("Enter new folder name :$: ")
- try:
- mkdir(new_folder_name)
- start()
- except:
- print 'Access is Denied'
- print '\n'
- raw_input('Press Enter To Restart')
- start()
- def dir_cont():
- print '[+] items in [ %s ]' %getcwd()
- for object in listdir(getcwd()):
- print object
- raw_input('Press Enter To Restart')
- start()
- def error():
- print ' ERROR : Invalid Choice or Empty Choice'
- print '\n'
- raw_input('Press Enter To Restart')
- start()
- def rename_file():
- file_to_rename=raw_input('File to rename :$: ')
- newname = raw_input('New Name of File %s :$: '%file_to_rename)
- try:
- rename(file_to_rename,newname)
- start()
- except OSError as msg:
- print 'Error :%s' %msg[1]
- print '\n'
- raw_input('Press Enter To Restart')
- start()
- def change_dir():
- loc_change_dir = raw_input('Path to change dir :$: ')
- try:
- chdir(loc_change_dir)
- start()
- except OSError as msg:
- print 'Error : %s' %msg[1]
- print '\n'
- raw_input('Press Enter To Restart')
- start()
- def shell_cmd():
- cmd = raw_input('[+] root@13lackDeMon :$: ')
- try:
- st = system(cmd)
- print st
- print shell_cmd()
- except KeyboardInterrupt:
- print 'User Bye'
- def start():
- try:
- clear = system('clear')
- except OSErrror:
- clear = system('cls')
- clear
- print '[*] simple command line file manager codded by 13lackDeMon / Tanmay'
- print '---------------------------------------------------------------------'
- print '[##] Current Dir :$ %s' %getcwd()
- print '**********************************'
- print '\n'
- print '[1] Move Folder \t[5] Rename File \t[9] Create Folder\n[2] Move File\t\t[6] Change Dir \t[10] Exit\n[3] Delete File \t[7] List Directory \n[4] Delete Folder \t[8] Excute Shell Command \n '
- choice = raw_input('->')
- if(choice=="1"):
- move_folder()
- elif(choice=="2"):
- move_file()
- elif(choice=="3"):
- del_file()
- elif(choice=="4"):
- del_fold()
- elif(choice=="5"):
- rename_file()
- elif(choice=="6"):
- change_dir()
- elif(choice=="7"):
- dir_cont()
- elif(choice=="8"):
- shell_cmd()
- elif(choice=="9"):
- create_folder()
- elif(choice=="10"):
- print '\n\r' + "[!] Thanks for using 13lackDemon command line manger"
- sys.exit(1)
- else:
- error()
- start() #start script ! :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement