-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManage-Files.ps1
More file actions
51 lines (31 loc) · 835 Bytes
/
Manage-Files.ps1
File metadata and controls
51 lines (31 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#
# Compare_Files.ps1
#
Function Compare-Files{
param(
[Parameter(Mandatory=$True)]
[string] $referenceobject,
[Parameter(Mandatory=$True)]
[string] $differenceobject
)
$source = Get-Content -Path $referenceobject
$targe = Get-Content -Path $differenceobject
Compare-Object $source $targe -IncludeEqual
}
#Example
#Compare-Strings -referenceobject "C:\Users\niliu\Downloads\old.txt" -differenceobject "C:\Users\niliu\Downloads\new.txt"
Function Rename-Files-In-Bunch{
param(
[Parameter(Mandatory=$False)]
[string] $prefix="[www.2tu.cc]",
[Parameter(Mandatory=$false)]
[string] $FileRoot = "G:\"
)
#(ls *.mp4).count
$prefix = [regex]::escape($prefix)
echo $prefix
cd $FileRoot
ls *.mp4 | %{ Move-Item -literalpath $_ ($_.name -replace "^$prefix",'') }
}
#Example:
Rename-Files-In-Bunch