-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbams_runs_covid.ps1
More file actions
55 lines (43 loc) · 1.46 KB
/
Copy pathbams_runs_covid.ps1
File metadata and controls
55 lines (43 loc) · 1.46 KB
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
51
52
53
54
55
###############################
# Autrice : Valentine Lesourd-Aubert
# Date de création : 13 Octobre 2021
# Objet : Suppression du dossier BAM contenu dans le dossier run précédent le dossier run le plus récent
###############################
### Création du fichier de Log
#$LogFile = "T:\Valentine\logs\"
#New-Item -Path $LogFile -Name "bam_covid.log" -type "file" -Force
#Début du bloc de script
#{
## PARAMETRAGE ##
#date actuelle
echo "`n"
$now= Get-Date -Format "yyMMdd_HHmm"
$current_year= Get-Date -Format "yyyy"
echo "date : $now"
#date de l'avant-dernier run et nom
$run= Get-ChildItem N:/nextseq_results/$current_year $dir | Sort-Object CreationTime -Descending | Select-Object -Index 1
$run_date= $run.LastWriteTime
echo "run date : $run_date | name: $run "
## MAIN ##
#Suppression du dossier BAM s'il existe
$bam_dir = $run.FullName | Join-Path -ChildPath "BAM"
echo "test if there is existing $bam_dir"
If( Test-Path -Path $bam_dir -ErrorAction SilentlyContinue )
{
echo "$bam_dir exists"
Remove-Item $bam_dir
If( Test-Path -Path $bam_dir -ErrorAction SilentlyContinue )
{
echo "ERROR : $bam_dir has not been removed"
}
Else
{
echo "$bam_dir have been successfully removed"
}
}
Else
{
echo "$bam_dir doesn't exist, already been removed?"
}
#} > $LogFile
#Fin block de script