-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca58575
commit 497ba43
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# purpose : To search and delete duplicate files | ||
# name : rakesh kumar | ||
# licence : MIT | ||
import os | ||
import sys #module for terminating | ||
import glob | ||
import tkinter as tk | ||
from tkinter import filedialog | ||
|
||
count=0 | ||
root = tk.Tk() | ||
root.withdraw() | ||
sourcedir = filedialog.askdirectory() | ||
os.chdir(sourcedir) | ||
source_files = glob.glob('*.*') | ||
targetdir = filedialog.askdirectory() | ||
if not targetdir.strip() : | ||
print ( "Folder Error...User did not selected any folder" ) | ||
#rootdir = 'C:\\Users\\ace | ||
sys.exit() | ||
for root, subFolders, files in os.walk(targetdir): | ||
os.chdir(root) | ||
files = glob.glob('*.*') | ||
for filename in files: | ||
if filename in source_files: | ||
os.unlink(filename) | ||
count+=1 | ||
print ( "Total {} files deleted" .format(count) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* Program to Find the Largest & Smallest Word in a String | ||
made by : rakesh kumar | ||
*/ | ||
#include <iostream> | ||
#include <string.h> | ||
#include <ctype.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100], word[20], max[20], min[20], c; | ||
int i = 0, j = 0, flag = 0; | ||
cout<<"Enter string: "; | ||
cin.getline(string,100); | ||
|
||
//processing phase | ||
for (i = 0; i < strlen(string); i++) | ||
{ | ||
while (i < strlen(string) && !isspace(string[i]) && isalnum(string[i])) | ||
{ | ||
word[j++] = string[i++]; | ||
} | ||
if (j != 0) | ||
{ | ||
word[j] = '\0'; | ||
|
||
if (flag==0) // this will run only once | ||
{ | ||
flag = 1; | ||
strcpy(max, word); | ||
strcpy(min, word); | ||
} | ||
if (strlen(word) > strlen(max)) | ||
{ | ||
strcpy(max, word); | ||
} | ||
if (strlen(word) < strlen(min)) | ||
{ | ||
strcpy(min, word); | ||
} | ||
j = 0; // for next word in the string | ||
} | ||
} | ||
|
||
//output phase | ||
cout<<"The largest word is '"<<max <<"' and smallest word is '"<<min<<"' in ''"<<string<<"'"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters