fileorganiser 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 63ac0f1929bcfa8d8e37508c84be0b19119f04fa87e42c2aa0e9cae38ef75c0e
4
+ data.tar.gz: 9ad2a1d92dc26267f5a6cc12a461a63c6de12346cbc14b858dcf7b019c8b8158
5
+ SHA512:
6
+ metadata.gz: 407201bef41896885138fb0d69d0ec6464cd15be82978abf39e9813ee7a69b1fb32e945d4f133ca5ec5feabb99c19f72e7d345a769e7cadc28c07b6f9f85a77b
7
+ data.tar.gz: 4dff58342968b3c9354abd139b0c457ff0d510c01a56fb18406cdce5d536b8ebeb392229ab48b70f46b15028f281c6de3d6f554d37658cb6cb6a9828ba4478e0
data/bin/fileorganiser ADDED
@@ -0,0 +1 @@
1
+ require "fileorganiser"
@@ -0,0 +1,20 @@
1
+ require "fileutils"
2
+
3
+ if ARGV.length == 1
4
+ src_dir = ARGV[0]
5
+
6
+ if Dir.exists?(src_dir)
7
+ filenames = Dir["#{src_dir}/*"].select{ |f| File.file? f }
8
+
9
+ filenames.each do |file|
10
+ ext = File.extname(file).gsub(".", "")
11
+ Dir.mkdir("#{src_dir}/#{ext}") unless Dir.exists?("#{src_dir}/#{ext}")
12
+ des_dir = "#{src_dir}/#{ext}/"
13
+ FileUtils.move(file, des_dir)
14
+ end
15
+ else
16
+ puts "ERROR: Directory does not exist"
17
+ end
18
+ else
19
+ puts "ERROR: Expected number of arguments is one."
20
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fileorganiser
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ajit Hande
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Organise all files according to their extension
14
+ email: ajithande1835@gmail.com
15
+ executables:
16
+ - fileorganiser
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/fileorganiser
21
+ - lib/fileorganiser.rb
22
+ homepage:
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.0.8
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: File Organiser
44
+ test_files: []